summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorauto-revert-processor <dev-prod-dag@mongodb.com>2021-09-23 00:14:41 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-09-23 00:53:17 +0000
commitfc885a164c0595624d9b50b9d950880414777781 (patch)
tree924899afa4d01bbb893ac37f2585551a857ee5da /src
parent4ae62e32c166d8483992ff49d53c00d238ba1aea (diff)
downloadmongo-fc885a164c0595624d9b50b9d950880414777781.tar.gz
Revert "SERVER-51592 Added support for anyElementTrue in SBE"
This reverts commit 130476fc56a711b489525112c855766bd2a1bb23.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/pipeline/expression.h8
-rw-r--r--src/mongo/db/query/sbe_stage_builder_expression.cpp35
-rw-r--r--src/mongo/db/query/sbe_stage_builder_helpers.h4
3 files changed, 7 insertions, 40 deletions
diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h
index 40bc488771d..f696152ec59 100644
--- a/src/mongo/db/pipeline/expression.h
+++ b/src/mongo/db/pipeline/expression.h
@@ -1001,9 +1001,13 @@ public:
class ExpressionAnyElementTrue final : public ExpressionFixedArity<ExpressionAnyElementTrue, 1> {
public:
explicit ExpressionAnyElementTrue(ExpressionContext* const expCtx)
- : ExpressionFixedArity<ExpressionAnyElementTrue, 1>(expCtx) {}
+ : ExpressionFixedArity<ExpressionAnyElementTrue, 1>(expCtx) {
+ expCtx->sbeCompatible = false;
+ }
ExpressionAnyElementTrue(ExpressionContext* const expCtx, ExpressionVector&& children)
- : ExpressionFixedArity<ExpressionAnyElementTrue, 1>(expCtx, std::move(children)) {}
+ : ExpressionFixedArity<ExpressionAnyElementTrue, 1>(expCtx, std::move(children)) {
+ expCtx->sbeCompatible = false;
+ }
Value evaluate(const Document& root, Variables* variables) const final;
const char* getOpName() const final;
diff --git a/src/mongo/db/query/sbe_stage_builder_expression.cpp b/src/mongo/db/query/sbe_stage_builder_expression.cpp
index 90dee12759a..4e25a8e18a9 100644
--- a/src/mongo/db/query/sbe_stage_builder_expression.cpp
+++ b/src/mongo/db/query/sbe_stage_builder_expression.cpp
@@ -849,40 +849,7 @@ public:
visitMultiBranchLogicExpression(expr, sbe::EPrimBinary::logicAnd);
}
void visit(const ExpressionAnyElementTrue* expr) final {
- auto [inputSlot, stage] = projectEvalExpr(_context->popEvalExpr(),
- _context->extractCurrentEvalStage(),
- _context->planNodeId,
- _context->state.slotIdGenerator);
-
- auto fromBranch = makeFilter<false>(
- std::move(stage),
- makeBinaryOp(sbe::EPrimBinary::logicOr,
- makeFillEmptyFalse(makeFunction("isArray", makeVariable(inputSlot))),
- makeFail(5159200, "$anyElementTrue's argument must be an array")),
- _context->planNodeId);
-
- auto innerOutputSlot = _context->state.slotId();
- auto innerBranch = makeProject(makeLimitCoScanStage(_context->planNodeId),
- _context->planNodeId,
- innerOutputSlot,
- generateCoerceToBoolExpression(inputSlot));
-
- auto traverseSlot = _context->state.slotId();
- auto traverseStage = makeTraverse(std::move(fromBranch),
- std::move(innerBranch),
- inputSlot,
- traverseSlot,
- innerOutputSlot,
- makeBinaryOp(sbe::EPrimBinary::logicOr,
- makeVariable(traverseSlot),
- makeVariable(innerOutputSlot)),
- makeVariable(traverseSlot),
- _context->planNodeId,
- 1,
- _context->getLexicalEnvironment());
-
- _context->pushExpr(makeFillEmptyFalse(makeVariable(traverseSlot)),
- std::move(traverseStage));
+ unsupportedExpression(expr->getOpName());
}
void visit(const ExpressionArray* expr) final {
unsupportedExpression(expr->getOpName());
diff --git a/src/mongo/db/query/sbe_stage_builder_helpers.h b/src/mongo/db/query/sbe_stage_builder_helpers.h
index 46f41471ac0..c5a63a3b002 100644
--- a/src/mongo/db/query/sbe_stage_builder_helpers.h
+++ b/src/mongo/db/query/sbe_stage_builder_helpers.h
@@ -216,10 +216,6 @@ std::unique_ptr<sbe::EExpression> makeVariable(sbe::value::SlotId slotId);
std::unique_ptr<sbe::EExpression> makeVariable(sbe::FrameId frameId, sbe::value::SlotId slotId);
-inline auto makeFail(int code, StringData errorMessage) {
- return sbe::makeE<sbe::EFail>(ErrorCodes::Error{code}, errorMessage);
-}
-
/**
* Check if expression returns Nothing and return null if so. Otherwise, return the expression.
*/