-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
ALL
-
161
The stage builder can create multiple local variables in the same variable frame, even if the SBE engine creates multiple single-variable frames when lowering the tree of instructions.
For instance,
optimizer::ABT makeLet(sbe::FrameId frameId, optimizer::ABTVector bindExprs, optimizer::ABT expr) { for (size_t idx = bindExprs.size(); idx > 0;) { --idx; expr = optimizer::make<optimizer::Let>( getABTLocalVariableName(frameId, idx), std::move(bindExprs[idx]), std::move(expr)); } return expr; }
but when the Let instruction is built around a variable name, it asserts if there is a non-0 index
optimizer::ABT makeLet(const optimizer::ProjectionName& name, optimizer::ABT bindExpr, optimizer::ABT expr) { // Verify that 'name' was generated by calling 'getABTLocalVariableName(N, 0)' for some // frame ID 'N'. auto localVarInfo = getSbeLocalVariableInfo(name); tassert(7654322, "", localVarInfo.has_value() && localVarInfo->second == 0); return optimizer::make<optimizer::Let>(name, std::move(bindExpr), std::move(expr)); }
Given that SERVER-88687 changed the generation of Compare expressions to use non-0 indexes, either the restriction is lifted, or 0-based variable indexes are restored
SbExpr generateExpressionCompare(StageBuilderState& state, ExpressionCompare::CmpOp op, SbExpr lhs, SbExpr rhs) { SbExprBuilder b(state); auto frameId = state.frameIdGenerator->generate(); auto lhsVar = SbLocalVar{frameId, 0}; auto rhsVar = SbLocalVar{frameId, 1};
The failure can be reproduced by adding this entry in jstests/libs/block_processing_test_cases.js
{ name: "GroupByWithComplexIdExpr", pipeline: [ {$match: {[timeFieldName]: {$lt: dateMidPoint}}}, { $group: { _id: { $lt: [ 29336, {$mod: ["$b", 1.0]} ] }, } } ], usesBlockProcessing: featureFlagsAllowBlockHashAgg },
- duplicates
-
SERVER-90365 Remove tassert from stage_builder::makeLet(const ProjectionName&,ABT,ABT)
- Closed
- is caused by
-
SERVER-88687 Avoid creating temporary mongo::Expression objects in the SBE stage builder
- Closed