diff options
author | Mickey. J Winters <mickey.winters@mongodb.com> | 2021-02-02 19:05:54 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-04 00:27:57 +0000 |
commit | a8a9d3d943d651493ce6e16bb6578a6b7c29f1f2 (patch) | |
tree | 73d10161e8622d6a0af4636841ee86c9f9166727 | |
parent | 87de2d8c2adbda44a43a147d870f6456d74689dc (diff) | |
download | mongo-a8a9d3d943d651493ce6e16bb6578a6b7c29f1f2.tar.gz |
SERVER-51551 Support expression $isArray in SBE
-rw-r--r-- | jstests/aggregation/bugs/server18222.js | 3 | ||||
-rw-r--r-- | src/mongo/db/query/sbe_stage_builder_expression.cpp | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/jstests/aggregation/bugs/server18222.js b/jstests/aggregation/bugs/server18222.js index 84ca2efa419..3a05eb99f61 100644 --- a/jstests/aggregation/bugs/server18222.js +++ b/jstests/aggregation/bugs/server18222.js @@ -1,7 +1,4 @@ // SERVER-18222: Add $isArray aggregation expression. -// @tags: [ -// sbe_incompatible, -// ] (function() { 'use strict'; var coll = db.is_array_expr; diff --git a/src/mongo/db/query/sbe_stage_builder_expression.cpp b/src/mongo/db/query/sbe_stage_builder_expression.cpp index 0fd67a8de62..cdbb8c8f826 100644 --- a/src/mongo/db/query/sbe_stage_builder_expression.cpp +++ b/src/mongo/db/query/sbe_stage_builder_expression.cpp @@ -2260,7 +2260,14 @@ public: unsupportedExpression(expr->getOpName()); } void visit(ExpressionIsArray* expr) final { - unsupportedExpression(expr->getOpName()); + auto frameId = _context->frameIdGenerator->generate(); + auto binds = sbe::makeEs(_context->popExpr()); + sbe::EVariable inputRef(frameId, 0); + + auto exprIsArr = makeFillEmptyFalse(makeFunction("isArray", inputRef.clone())); + + _context->pushExpr( + sbe::makeE<sbe::ELocalBind>(frameId, std::move(binds), std::move(exprIsArr))); } void visit(ExpressionRound* expr) final { unsupportedExpression(expr->getOpName()); |