diff options
author | George Wangensteen <george.wangensteen@mongodb.com> | 2020-09-23 15:41:17 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-10-08 07:22:52 +0000 |
commit | 5c1ec93ae1ade70ea176060166b1c96c8ec01e48 (patch) | |
tree | 0a40dfff80f8b5646924b4ab9dd41c11b90ae3b2 /src/mongo/db/pipeline | |
parent | d9a570a49aae682cdaccf2afeb284194fea38bc4 (diff) | |
download | mongo-5c1ec93ae1ade70ea176060166b1c96c8ec01e48.tar.gz |
SERVER-48863 Implement agg array operators starting with A-I in grammar.
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r-- | src/mongo/db/pipeline/expression.h | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h index bd711560466..6f70baf2724 100644 --- a/src/mongo/db/pipeline/expression.h +++ b/src/mongo/db/pipeline/expression.h @@ -884,6 +884,9 @@ public: explicit ExpressionArrayElemAt(ExpressionContext* const expCtx) : ExpressionFixedArity<ExpressionArrayElemAt, 2>(expCtx) {} + ExpressionArrayElemAt(ExpressionContext* const expCtx, ExpressionVector&& children) + : ExpressionFixedArity<ExpressionArrayElemAt, 2>(expCtx, std::move(children)) {} + Value evaluate(const Document& root, Variables* variables) const final; const char* getOpName() const final; @@ -897,6 +900,9 @@ public: explicit ExpressionFirst(ExpressionContext* const expCtx) : ExpressionFixedArity<ExpressionFirst, 1>(expCtx) {} + ExpressionFirst(ExpressionContext* const expCtx, ExpressionVector&& children) + : ExpressionFixedArity<ExpressionFirst, 1>(expCtx, std::move(children)) {} + Value evaluate(const Document& root, Variables* variables) const final; const char* getOpName() const final; @@ -936,6 +942,9 @@ public: explicit ExpressionArrayToObject(ExpressionContext* const expCtx) : ExpressionFixedArity<ExpressionArrayToObject, 1>(expCtx) {} + ExpressionArrayToObject(ExpressionContext* const expCtx, ExpressionVector&& children) + : ExpressionFixedArity<ExpressionArrayToObject, 1>(expCtx, std::move(children)) {} + Value evaluate(const Document& root, Variables* variables) const final; const char* getOpName() const final; @@ -1072,6 +1081,9 @@ public: explicit ExpressionConcatArrays(ExpressionContext* const expCtx) : ExpressionVariadic<ExpressionConcatArrays>(expCtx) {} + ExpressionConcatArrays(ExpressionContext* const expCtx, ExpressionVector&& children) + : ExpressionVariadic<ExpressionConcatArrays>(expCtx, std::move(children)) {} + Value evaluate(const Document& root, Variables* variables) const final; const char* getOpName() const final; @@ -1468,6 +1480,12 @@ public: BSONElement expr, const VariablesParseState& vps); + ExpressionFilter(ExpressionContext* const expCtx, + std::string varName, + Variables::Id varId, + boost::intrusive_ptr<Expression> input, + boost::intrusive_ptr<Expression> filter); + void acceptVisitor(ExpressionVisitor* visitor) final { return visitor->visit(this); } @@ -1480,12 +1498,6 @@ protected: void _doAddDependencies(DepsTracker* deps) const final; private: - ExpressionFilter(ExpressionContext* const expCtx, - std::string varName, - Variables::Id varId, - boost::intrusive_ptr<Expression> input, - boost::intrusive_ptr<Expression> filter); - // The name of the variable to set to each element in the array. std::string _varName; // The id of the variable to set. @@ -1550,7 +1562,11 @@ public: explicit ExpressionIn(ExpressionContext* const expCtx) : ExpressionFixedArity<ExpressionIn, 2>(expCtx) {} + ExpressionIn(ExpressionContext* const expCtx, ExpressionVector&& children) + : ExpressionFixedArity<ExpressionIn, 2>(expCtx, std::move(children)) {} + Value evaluate(const Document& root, Variables* variables) const final; + const char* getOpName() const final; void acceptVisitor(ExpressionVisitor* visitor) final { @@ -1564,6 +1580,8 @@ public: explicit ExpressionIndexOfArray(ExpressionContext* const expCtx) : ExpressionRangedArity<ExpressionIndexOfArray, 2, 4>(expCtx) {} + ExpressionIndexOfArray(ExpressionContext* const expCtx, ExpressionVector&& children) + : ExpressionRangedArity<ExpressionIndexOfArray, 2, 4>(expCtx, std::move(children)) {} Value evaluate(const Document& root, Variables* variables) const; boost::intrusive_ptr<Expression> optimize() final; @@ -2292,6 +2310,9 @@ public: explicit ExpressionIsArray(ExpressionContext* const expCtx) : ExpressionFixedArity<ExpressionIsArray, 1>(expCtx) {} + ExpressionIsArray(ExpressionContext* const expCtx, ExpressionVector&& children) + : ExpressionFixedArity<ExpressionIsArray, 1>(expCtx, std::move(children)) {} + Value evaluate(const Document& root, Variables* variables) const final; const char* getOpName() const final; |