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.h | |
| 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.h')
| -rw-r--r-- | src/mongo/db/matcher/rewrite_expr.h | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/src/mongo/db/matcher/rewrite_expr.h b/src/mongo/db/matcher/rewrite_expr.h index 08e7d82d23d..1752c9726b8 100644 --- a/src/mongo/db/matcher/rewrite_expr.h +++ b/src/mongo/db/matcher/rewrite_expr.h @@ -42,20 +42,14 @@ namespace mongo { class RewriteExpr final { public: /** - * Holds the result of an Expression rewrite operation. $expr expressions can't take advantage - * of indexes. When we rewrite the expressions as a conjunction of internal match expressions, - * the query planner can now use the internal match expressions to potentially generate an index - * scan. We use internal match expressions that are non-type bracketed to match non-type - * bracketed comparison operators inside $expr. + * Holds the result of an Expression rewrite operation. */ class RewriteResult final { public: RewriteResult(std::unique_ptr<MatchExpression> matchExpression, - std::vector<BSONObj> matchExprElemStorage, - bool allSubExpressionsRewritten) + std::vector<BSONObj> matchExprElemStorage) : _matchExpression(std::move(matchExpression)), - _matchExprElemStorage(std::move(matchExprElemStorage)), - _allSubExpressionsRewritten(allSubExpressionsRewritten) {} + _matchExprElemStorage(std::move(matchExprElemStorage)) {} MatchExpression* matchExpression() const { return _matchExpression.get(); @@ -67,11 +61,7 @@ public: RewriteResult clone() const { auto clonedMatch = _matchExpression ? _matchExpression->shallowClone() : nullptr; - return {std::move(clonedMatch), _matchExprElemStorage, _allSubExpressionsRewritten}; - } - - bool allSubExpressionsRewritten() { - return _allSubExpressionsRewritten; + return {std::move(clonedMatch), _matchExprElemStorage}; } private: @@ -81,22 +71,12 @@ public: // owned and expected to outlive the MatchExpression. '_matchExprElemStorage' holds the // underlying BSONObj storage for these arguments. std::vector<BSONObj> _matchExprElemStorage; - - // Defaults to true, is false if there is a child in an $or/$and expression that - // contains children that cannot be rewritten to a MatchExpression. - bool _allSubExpressionsRewritten = true; }; /** - * Attempts to construct a MatchExpression that will match against either an identical set - * or a superset of the documents matched by 'expr'. Due to semantic differences the - * rewritten MatchExpression might match more documents than the ExprMatchExpression. For - * example, - * $_internalExprEq in MatchExpression reaches into arrays, and $eq in ExprMatchExpression - * does not. However, $_internalExprLt/$_internalExprGt are non-type bracketed for - * MatchExpression, just like ExprMatchExpressions. Returns the MatchExpression as a - * RewriteResult. If a rewrite is not possible, RewriteResult::matchExpression() will return - * a nullptr. + * Attempts to construct a MatchExpression that will match against either an identical set or a + * superset of the documents matched by 'expr'. Returns the MatchExpression as a RewriteResult. + * If a rewrite is not possible, RewriteResult::matchExpression() will return a nullptr. */ static RewriteResult rewrite(const boost::intrusive_ptr<Expression>& expr, const CollatorInterface* collator); @@ -127,7 +107,6 @@ private: std::vector<BSONObj> _matchExprElemStorage; const CollatorInterface* _collator; - bool _allSubExpressionsRewritten = true; }; } // namespace mongo |
