diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
| commit | 4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch) | |
| tree | 1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/matcher/rewrite_expr.cpp | |
| parent | aa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff) | |
| parent | 8f0827553e09872941945a093b647a4211a9db7f (diff) | |
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0'
with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/db/matcher/rewrite_expr.cpp')
| -rw-r--r-- | src/mongo/db/matcher/rewrite_expr.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/mongo/db/matcher/rewrite_expr.cpp b/src/mongo/db/matcher/rewrite_expr.cpp index 4f44cd269ef..e61ddeaab78 100644 --- a/src/mongo/db/matcher/rewrite_expr.cpp +++ b/src/mongo/db/matcher/rewrite_expr.cpp @@ -45,7 +45,7 @@ using CmpOp = ExpressionCompare::CmpOp; RewriteExpr::RewriteResult RewriteExpr::rewrite(const boost::intrusive_ptr<Expression>& expression, const CollatorInterface* collator) { LOGV2_DEBUG( - 20725, 5, "Expression prior to rewrite", "expression"_attr = expression->serialize()); + 20725, 5, "Expression prior to rewrite", "expression"_attr = expression->serialize(false)); RewriteExpr rewriteExpr(collator); std::unique_ptr<MatchExpression> matchExpression; @@ -63,9 +63,7 @@ RewriteExpr::RewriteResult RewriteExpr::rewrite(const boost::intrusive_ptr<Expre "expression"_attr = matchExpression->debugString()); } - return {std::move(matchExpression), - std::move(rewriteExpr._matchExprElemStorage), - rewriteExpr._allSubExpressionsRewritten}; + return {std::move(matchExpression), std::move(rewriteExpr._matchExprElemStorage)}; } std::unique_ptr<MatchExpression> RewriteExpr::_rewriteExpression( @@ -88,11 +86,8 @@ std::unique_ptr<MatchExpression> RewriteExpr::_rewriteAndExpression( auto andMatch = std::make_unique<AndMatchExpression>(); for (auto&& child : currExprNode->getOperandList()) - if (auto childMatch = _rewriteExpression(child)) { + if (auto childMatch = _rewriteExpression(child)) andMatch->add(std::move(childMatch)); - } else { - _allSubExpressionsRewritten = false; - } if (andMatch->numChildren() > 0) return andMatch; @@ -107,12 +102,10 @@ std::unique_ptr<MatchExpression> RewriteExpr::_rewriteOrExpression( for (auto&& child : currExprNode->getOperandList()) if (auto childExpr = _rewriteExpression(child)) orMatch->add(std::move(childExpr)); - else { + else // If any child cannot be rewritten to a MatchExpression then we must abandon adding // this $or clause. - _allSubExpressionsRewritten = false; return nullptr; - } if (orMatch->numChildren() > 0) return orMatch; |
