diff options
author | Rui Liu <rui.liu@mongodb.com> | 2022-04-11 16:42:33 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-04-11 23:17:22 +0000 |
commit | a3f6a5a1aa650fbb4b163bd47512469158b49a50 (patch) | |
tree | 4259fb4c5efe5bad1e0176176d02cbd7db7b1ba1 | |
parent | bf35d99d2816e3815eb97308a287a5f6654f148e (diff) | |
download | mongo-a3f6a5a1aa650fbb4b163bd47512469158b49a50.tar.gz |
SERVER-65202 Fix inconsistency of matching undefined with different join algorithms
-rw-r--r-- | jstests/aggregation/sources/lookup/lookup_equijoin_semantics_lib.js | 3 | ||||
-rw-r--r-- | src/mongo/db/exec/sbe/values/value.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/jstests/aggregation/sources/lookup/lookup_equijoin_semantics_lib.js b/jstests/aggregation/sources/lookup/lookup_equijoin_semantics_lib.js index c147d357739..e728b817acc 100644 --- a/jstests/aggregation/sources/lookup/lookup_equijoin_semantics_lib.js +++ b/jstests/aggregation/sources/lookup/lookup_equijoin_semantics_lib.js @@ -284,8 +284,7 @@ function runTests() { localField: "b", foreignRecords: docs, foreignField: "a", - // TODO SERVER-65202: matching of "undefined" isn't consistent - idsExpectedToMatch: (currentJoinAlgorithm != JoinAlgorithm.HJ) ? [2] : [] + idsExpectedToMatch: [] }); } else { // Due to legacy reasons, in the classic engine "undefined" either matches to null or diff --git a/src/mongo/db/exec/sbe/values/value.cpp b/src/mongo/db/exec/sbe/values/value.cpp index 1a63eacc94a..90b626e2a8d 100644 --- a/src/mongo/db/exec/sbe/values/value.cpp +++ b/src/mongo/db/exec/sbe/values/value.cpp @@ -836,6 +836,9 @@ std::pair<TypeTags, Value> compareValue(TypeTags lhsTag, bitcastFrom<const char*>(rhsCws.scope)); } else { // Different types. + if (lhsTag == TypeTags::Nothing || rhsTag == TypeTags::Nothing) { + return {TypeTags::Nothing, 0}; + } auto lhsType = tagToType(lhsTag); auto rhsType = tagToType(rhsTag); tassert(5365500, "values cannot have the same type", lhsType != rhsType); |