From b6dfdd6e9934e0799903fbbe14c265a98eac33d7 Mon Sep 17 00:00:00 2001 From: Patrick LeBlanc <43503225+pleblanc1976@users.noreply.github.com> Date: Tue, 14 Jan 2020 22:28:15 -0600 Subject: [PATCH] Merge pull request #1000 from drrtuy/MCOL-1734_2 MCOL-1734 CS now behaves similar to MDB in case of NOT IN + correlated subquery if the subquery returns empty set. --- dbcon/mysql/ha_mcs_impl.cpp | 2 +- primitives/primproc/batchprimitiveprocessor.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dbcon/mysql/ha_mcs_impl.cpp b/dbcon/mysql/ha_mcs_impl.cpp index 766cfbea7..3b71dd5f9 100644 --- a/dbcon/mysql/ha_mcs_impl.cpp +++ b/dbcon/mysql/ha_mcs_impl.cpp @@ -2303,7 +2303,7 @@ int ha_mcs_impl_direct_update_delete_rows(bool execute, ha_rows *affected_rows) *affected_rows = ci->affectedRows; } - return 0; + return rc; } int ha_mcs_impl_rnd_init(TABLE* table) diff --git a/primitives/primproc/batchprimitiveprocessor.cpp b/primitives/primproc/batchprimitiveprocessor.cpp index b08c27de5..64a9d2455 100644 --- a/primitives/primproc/batchprimitiveprocessor.cpp +++ b/primitives/primproc/batchprimitiveprocessor.cpp @@ -1174,6 +1174,7 @@ void BatchPrimitiveProcessor::executeTupleJoin() break; } + if (LIKELY(!typelessJoin[j])) { //cout << "not typeless join\n"; @@ -1186,6 +1187,8 @@ void BatchPrimitiveProcessor::executeTupleJoin() largeKey = oldRow.getIntField(colIndex); uint bucket = bucketPicker((char *) &largeKey, 8, bpSeed) & ptMask; + bool joinerIsEmpty = tJoiners[j][bucket]->empty() ? true : false; + found = (tJoiners[j][bucket]->find(largeKey) != tJoiners[j][bucket]->end()); isNull = oldRow.isNullValue(colIndex); /* These conditions define when the row is NOT in the result set: @@ -1195,7 +1198,7 @@ void BatchPrimitiveProcessor::executeTupleJoin() */ if (((!found || isNull) && !(joinTypes[j] & (LARGEOUTER | ANTI))) || - ((joinTypes[j] & ANTI) && ((isNull && (joinTypes[j] & MATCHNULLS)) || (found && !isNull)))) + ((joinTypes[j] & ANTI) && !joinerIsEmpty && ((isNull && (joinTypes[j] & MATCHNULLS)) || (found && !isNull)))) { //cout << " - not in the result set\n"; break;