diff options
author | Justin Seyster <justin.seyster@mongodb.com> | 2017-09-28 21:54:20 -0400 |
---|---|---|
committer | Justin Seyster <justin.seyster@mongodb.com> | 2017-09-28 21:54:20 -0400 |
commit | e3bb43cfa8ac0d04ba28ffd3b09a53785feabb31 (patch) | |
tree | ec22edf29d746877baa697f80bc10d0b40ebb616 /src/mongo/db/matcher/expression_leaf.cpp | |
parent | 3cf4e0593c394dd7eb45d8000d76b5dc73a3f425 (diff) | |
download | mongo-e3bb43cfa8ac0d04ba28ffd3b09a53785feabb31.tar.gz |
Revert "SERVER-30991 Introduce MatchExpression::optimize()."
This reverts commit 3cf4e0593c394dd7eb45d8000d76b5dc73a3f425.
Reverting because of a Clang compile error.
Diffstat (limited to 'src/mongo/db/matcher/expression_leaf.cpp')
-rw-r--r-- | src/mongo/db/matcher/expression_leaf.cpp | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/mongo/db/matcher/expression_leaf.cpp b/src/mongo/db/matcher/expression_leaf.cpp index a1fc305b3cf..6a3502566e8 100644 --- a/src/mongo/db/matcher/expression_leaf.cpp +++ b/src/mongo/db/matcher/expression_leaf.cpp @@ -539,43 +539,6 @@ Status InMatchExpression::addRegex(std::unique_ptr<RegexMatchExpression> expr) { return Status::OK(); } -MatchExpression::ExpressionOptimizerFunc InMatchExpression::getOptimizer() const { - return [](std::unique_ptr<MatchExpression> expression) -> std::unique_ptr<MatchExpression> { - // NOTE: We do not recursively call optimize() on the RegexMatchExpression children in the - // _regexes list. We assume that optimize() on a RegexMatchExpression is a no-op. - - auto& regexList = static_cast<InMatchExpression&>(*expression)._regexes; - auto& equalitySet = static_cast<InMatchExpression&>(*expression)._equalitySet; - auto collator = static_cast<InMatchExpression&>(*expression).getCollator(); - if (regexList.size() == 1 && equalitySet.empty()) { - // Simplify IN of exactly one regex to be a regex match. - auto& childRe = regexList.front(); - invariant(!childRe->getTag()); - - auto simplifiedExpression = stdx::make_unique<RegexMatchExpression>(); - invariantOK(simplifiedExpression->init( - expression->path(), childRe->getString(), childRe->getFlags())); - if (expression->getTag()) { - simplifiedExpression->setTag(expression->getTag()->clone()); - } - - return simplifiedExpression; - } else if (equalitySet.size() == 1 && regexList.empty()) { - // Simplify IN of exactly one equality to be an EqualityMatchExpression. - auto simplifiedExpression = stdx::make_unique<EqualityMatchExpression>(); - invariantOK(simplifiedExpression->init(expression->path(), *(equalitySet.begin()))); - simplifiedExpression->setCollator(collator); - if (expression->getTag()) { - simplifiedExpression->setTag(expression->getTag()->clone()); - } - - return simplifiedExpression; - } - - return expression; - }; -} - // ----------- Status BitTestMatchExpression::init(StringData path, std::vector<uint32_t> bitPositions) { |