diff options
author | Alyssa Wagenmaker <alyssa.wagenmaker@mongodb.com> | 2022-10-27 19:46:47 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-10-27 20:40:46 +0000 |
commit | 0145e23406884cade3b44e7e57b20a7c62bbdb0a (patch) | |
tree | a3ad0f67bf94bc50019503236ccc9f58e6ff6fb0 /src/mongo/db/matcher/expression_algo.cpp | |
parent | 7b9c8c6a22e38fd34ca313bb0637615f3075f720 (diff) | |
download | mongo-0145e23406884cade3b44e7e57b20a7c62bbdb0a.tar.gz |
SERVER-65494 handle empty field names for column scan
Also, disambiguate between "no path" and "empty path" for path match expressions.
Diffstat (limited to 'src/mongo/db/matcher/expression_algo.cpp')
-rw-r--r-- | src/mongo/db/matcher/expression_algo.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/db/matcher/expression_algo.cpp b/src/mongo/db/matcher/expression_algo.cpp index 03693da929c..a51bc0e838d 100644 --- a/src/mongo/db/matcher/expression_algo.cpp +++ b/src/mongo/db/matcher/expression_algo.cpp @@ -816,6 +816,26 @@ bool containsOverlappingPaths(const OrderedPathSet& testSet) { return false; } +bool containsEmptyPaths(const OrderedPathSet& testSet) { + return std::any_of(testSet.begin(), testSet.end(), [](const auto& path) { + if (path.empty()) { + return true; + } + + FieldRef fieldRef(path); + + for (size_t i = 0; i < fieldRef.numParts(); ++i) { + if (fieldRef.getPart(i).empty()) { + return true; + } + } + + // all non-empty + return false; + }); +} + + bool areIndependent(const OrderedPathSet& pathSet1, const OrderedPathSet& pathSet2) { return !containsDependency(pathSet1, pathSet2) && !containsDependency(pathSet2, pathSet1); } |