diff options
44 files changed, 2545 insertions, 4979 deletions
diff --git a/src/mongo/db/exec/sbe/abt/sbe_abt_test.cpp b/src/mongo/db/exec/sbe/abt/sbe_abt_test.cpp index da96a3f9767..7c7eb655b0c 100644 --- a/src/mongo/db/exec/sbe/abt/sbe_abt_test.cpp +++ b/src/mongo/db/exec/sbe/abt/sbe_abt_test.cpp @@ -503,7 +503,7 @@ TEST_F(NodeSBE, Lower2) { {true /*debugMode*/, 2 /*debugLevel*/, DebugInfo::kIterationLimitForTests}); phaseManager.optimize(root); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -514,26 +514,13 @@ TEST_F(NodeSBE, Lower2) { "| | | rid_0 = rid_1\n" "| | Collation\n" "| | Ascending\n" - "| Union []\n" - "| | BindBlock:\n" - "| | [rid_1]\n" - "| | Source []\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [rid_1]\n" - "| | Variable [rid_0]\n" - "| IndexScan [{'<rid>': rid_0}, scanDefName: test, indexDefName: index2, interval: " - "{=Const [2]}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" - "IndexScan [{'<indexKey> 0': pa, '<rid>': rid_0}, scanDefName: test, indexDefName: index1, " - "interval: {=Const [1]}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n", + "| Union [{rid_1}]\n" + "| Evaluation [{rid_1}]\n" + "| | Variable [rid_0]\n" + "| IndexScan [{'<rid>': rid_0}, scanDefName: test, indexDefName: index2, interval: {=Co" + "nst [2]}]\n" + "IndexScan [{'<indexKey> 0': pa, '<rid>': rid_0}, scanDefName: test, indexDefName: index1" + ", interval: {=Const [1]}]\n", root); // Find the MergeJoin, replace it with SortedMerge. To do this we need to remove the Union and @@ -575,7 +562,7 @@ TEST_F(NodeSBE, Lower2) { } // Now we should have a plan with a SortedMerge in it. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -584,21 +571,10 @@ TEST_F(NodeSBE, Lower2) { "SortedMerge []\n" "| | | collation: \n" "| | | rid_0: Ascending\n" - "| | BindBlock:\n" - "| | [rid_0]\n" - "| | Source []\n" - "| IndexScan [{'<rid>': rid_0}, scanDefName: test, indexDefName: index2, interval: " - "{=Const [2]}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" - "IndexScan [{'<indexKey> 0': pa, '<rid>': rid_0}, scanDefName: test, indexDefName: index1, " - "interval: {=Const [1]}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n", + "| IndexScan [{'<rid>': rid_0}, scanDefName: test, indexDefName: index2, interval: {=Co" + "nst [2]}]\n" + "IndexScan [{'<indexKey> 0': pa, '<rid>': rid_0}, scanDefName: test, indexDefName: index1" + ", interval: {=Const [1]}]\n", root); // TODO SERVER-72010 fix test or SortedMergeNode logic so building VariableEnvironment succeeds @@ -793,63 +769,30 @@ TEST_F(NodeSBE, SpoolFibonacci) { "| | val\n" "| RefBlock: \n" "| Variable [val]\n" - "SpoolProducer [Lazy, id: 1]\n" + "SpoolProducer [Lazy, id: 1, {it, val, val_prev}]\n" "| | Const [true]\n" - "| BindBlock:\n" - "| [it]\n" - "| Source []\n" - "| [val]\n" - "| Source []\n" - "| [val_prev]\n" - "| Source []\n" - "Union []\n" - "| | BindBlock:\n" - "| | [it]\n" - "| | Source []\n" - "| | [val]\n" - "| | Source []\n" - "| | [val_prev]\n" - "| | Source []\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [val]\n" - "| | BinaryOp [Add]\n" - "| | | Variable [valIn_prev]\n" - "| | Variable [valIn]\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [val_prev]\n" - "| | Variable [valIn]\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [it]\n" - "| | BinaryOp [Add]\n" - "| | | Const [1]\n" - "| | Variable [itIn]\n" + "Union [{it, val, val_prev}]\n" + "| Evaluation [{val}]\n" + "| | BinaryOp [Add]\n" + "| | | Variable [valIn_prev]\n" + "| | Variable [valIn]\n" + "| Evaluation [{val_prev}]\n" + "| | Variable [valIn]\n" + "| Evaluation [{it}]\n" + "| | BinaryOp [Add]\n" + "| | | Const [1]\n" + "| | Variable [itIn]\n" "| Filter []\n" "| | BinaryOp [Lt]\n" "| | | Const [10]\n" "| | Variable [itIn]\n" - "| SpoolConsumer [Stack, id: 1]\n" - "| BindBlock:\n" - "| [itIn]\n" - "| Source []\n" - "| [valIn]\n" - "| Source []\n" - "| [valIn_prev]\n" - "| Source []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [val]\n" - "| Const [1]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [val_prev]\n" - "| Const [0]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [it]\n" - "| Const [1]\n" + "| SpoolConsumer [Stack, id: 1, {itIn, valIn, valIn_prev}]\n" + "Evaluation [{val}]\n" + "| Const [1]\n" + "Evaluation [{val_prev}]\n" + "| Const [0]\n" + "Evaluation [{it}]\n" + "| Const [1]\n" "LimitSkip []\n" "| limitSkip:\n" "| limit: 1\n" diff --git a/src/mongo/db/pipeline/abt/abt_translation_test.cpp b/src/mongo/db/pipeline/abt/abt_translation_test.cpp index fe997690751..d7d9e021c43 100644 --- a/src/mongo/db/pipeline/abt/abt_translation_test.cpp +++ b/src/mongo/db/pipeline/abt/abt_translation_test.cpp @@ -220,7 +220,7 @@ TEST_F(ServiceContextTest, CanonicalQueryTranslation) { ProjectionName{"test"}, make<ScanNode>("test", "test"), prefixId); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | test\n" @@ -247,10 +247,7 @@ TEST_F(ServiceContextTest, CanonicalQueryTranslation) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [30]\n" - "Scan [test]\n" - " BindBlock:\n" - " [test]\n" - " Source []\n", + "Scan [test, {test}]\n", translation); } @@ -265,24 +262,22 @@ TEST_F(ServiceContextTest, NonDescriptiveNames) { translatePipeline(metadata, pipeline, scanProjName, "collection", prefixId, {}); // Observe projection names are not descriptive. They are of the form "pXXXX". - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | p4\n" "| RefBlock: \n" "| Variable [p4]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p4]\n" - "| EvalPath []\n" - "| | Const [{}]\n" - "| PathComposeM []\n" - "| | PathField [s]\n" - "| | PathConstant []\n" - "| | Variable [p2]\n" - "| PathField [_id]\n" - "| PathConstant []\n" - "| Variable [p1]\n" + "Evaluation [{p4}]\n" + "| EvalPath []\n" + "| | Const [{}]\n" + "| PathComposeM []\n" + "| | PathField [s]\n" + "| | PathConstant []\n" + "| | Variable [p2]\n" + "| PathField [_id]\n" + "| PathConstant []\n" + "| Variable [p1]\n" "GroupBy []\n" "| | groupings: \n" "| | RefBlock: \n" @@ -291,31 +286,24 @@ TEST_F(ServiceContextTest, NonDescriptiveNames) { "| [p2]\n" "| FunctionCall [$sum]\n" "| Variable [p3]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p3]\n" - "| BinaryOp [Mult]\n" - "| | EvalPath []\n" - "| | | Variable [p0]\n" - "| | PathGet [c]\n" - "| | PathIdentity []\n" - "| EvalPath []\n" - "| | Variable [p0]\n" - "| PathGet [b]\n" - "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p1]\n" - "| EvalPath []\n" - "| | Variable [p0]\n" - "| PathGet [a]\n" - "| PathTraverse [inf]\n" - "| PathGet [b]\n" - "| PathIdentity []\n" - "Scan [collection]\n" - " BindBlock:\n" - " [p0]\n" - " Source []\n", + "Evaluation [{p3}]\n" + "| BinaryOp [Mult]\n" + "| | EvalPath []\n" + "| | | Variable [p0]\n" + "| | PathGet [c]\n" + "| | PathIdentity []\n" + "| EvalPath []\n" + "| | Variable [p0]\n" + "| PathGet [b]\n" + "| PathIdentity []\n" + "Evaluation [{p1}]\n" + "| EvalPath []\n" + "| | Variable [p0]\n" + "| PathGet [a]\n" + "| PathTraverse [inf]\n" + "| PathGet [b]\n" + "| PathIdentity []\n" + "Scan [collection, {p0}]\n", translated); } diff --git a/src/mongo/db/query/cost_model/cost_model_test.cpp b/src/mongo/db/query/cost_model/cost_model_test.cpp index 3a7dea46274..af6e2cfa4e5 100644 --- a/src/mongo/db/query/cost_model/cost_model_test.cpp +++ b/src/mongo/db/query/cost_model/cost_model_test.cpp @@ -72,7 +72,7 @@ TEST(CostModel, IncreaseIndexScanCost) { ABT optimized = rootNode; phaseManager.optimize(optimized); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -85,16 +85,10 @@ TEST(CostModel, IncreaseIndexScanCost) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: " - "{=Const [1]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " + "[1]}]\n", optimized); } @@ -118,7 +112,7 @@ TEST(CostModel, IncreaseIndexScanCost) { ABT optimized = rootNode; phaseManager.optimize(optimized); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -130,12 +124,7 @@ TEST(CostModel, IncreaseIndexScanCost) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1]\n" - " BindBlock:\n" - " [evalTemp_0]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1]\n", optimized); } } @@ -185,7 +174,7 @@ TEST(CostModel, IncreaseJoinsCost) { ABT optimized = rootNode; phaseManager.optimize(optimized); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -196,26 +185,13 @@ TEST(CostModel, IncreaseJoinsCost) { "| | | rid_0 = rid_1\n" "| | Collation\n" "| | Ascending\n" - "| Union []\n" - "| | BindBlock:\n" - "| | [rid_1]\n" - "| | Source []\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [rid_1]\n" - "| | Variable [rid_0]\n" + "| Union [{rid_1}]\n" + "| Evaluation [{rid_1}]\n" + "| | Variable [rid_0]\n" "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index2, interval: " "{=Const [2]}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" "IndexScan [{'<indexKey> 0': pa, '<rid>': rid_0}, scanDefName: c1, indexDefName: " - "index1, interval: {=Const [1]}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n", + "index1, interval: {=Const [1]}]\n", optimized); } @@ -278,7 +254,7 @@ TEST(CostModel, IncreaseJoinsCost) { ABT optimized = rootNode; phaseManager.optimize(optimized); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -294,12 +270,7 @@ TEST(CostModel, IncreaseJoinsCost) { "| | Variable [pa]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "PhysicalScan [{'a': pa, 'b': evalTemp_1}, c1]\n" - " BindBlock:\n" - " [evalTemp_1]\n" - " Source []\n" - " [pa]\n" - " Source []\n", + "PhysicalScan [{'a': pa, 'b': evalTemp_1}, c1]\n", optimized); } } diff --git a/src/mongo/db/query/optimizer/explain.cpp b/src/mongo/db/query/optimizer/explain.cpp index b3a6358bfec..fb9af129873 100644 --- a/src/mongo/db/query/optimizer/explain.cpp +++ b/src/mongo/db/query/optimizer/explain.cpp @@ -711,40 +711,57 @@ public: } } - static void printCorrelatedProjections( - ExplainPrinter& printer, const mongo::optimizer::ProjectionNameSet& correlatedProjections) { - ProjectionNameOrderedSet ordered; - for (const ProjectionName& projName : correlatedProjections) { - ordered.insert(projName); - } - + static void printProjections(ExplainPrinter& printer, + const ProjectionNameOrderedSet& projections) { if constexpr (version < ExplainVersion::V3) { - if (!correlatedProjections.empty()) { - printer.print(", {"); + if (!projections.empty()) { + printer.separator("{"); bool first = true; - for (const ProjectionName& projectionName : ordered) { + for (const ProjectionName& projectionName : projections) { if (first) { first = false; } else { - printer.print(", "); + printer.separator(", "); } printer.print(projectionName); } - printer.print("}"); + printer.separator("}"); } } else if constexpr (version == ExplainVersion::V3) { std::vector<ExplainPrinter> printers; - for (const ProjectionName& projectionName : ordered) { + for (const ProjectionName& projectionName : projections) { ExplainPrinter local; local.print(projectionName); printers.push_back(std::move(local)); } - printer.fieldName("correlatedProjections").print(printers); + printer.print(printers); } else { MONGO_UNREACHABLE; } } + static void printProjections(ExplainPrinter& printer, const ProjectionNameVector& projections) { + ProjectionNameOrderedSet projectionSet(projections.begin(), projections.end()); + printProjections(printer, projectionSet); + } + + static void printProjection(ExplainPrinter& printer, const ProjectionName& projection) { + ProjectionNameOrderedSet projectionSet = {projection}; + printProjections(printer, projectionSet); + } + + static void printCorrelatedProjections( + ExplainPrinter& printer, const mongo::optimizer::ProjectionNameSet& correlatedProjections) { + ProjectionNameOrderedSet ordered; + for (const ProjectionName& projName : correlatedProjections) { + ordered.insert(projName); + } + + printer.fieldName("correlatedProjections", ExplainVersion::V3); + printProjections(printer, ordered); + } + + /** * Nodes */ @@ -759,26 +776,23 @@ public: ExplainPrinter transport(const ABT& /*n*/, const ExpressionBinder& binders, std::vector<ExplainPrinter> inResults) { - std::map<ProjectionName, ExplainPrinter> ordered; - for (size_t idx = 0; idx < inResults.size(); ++idx) { - ordered.emplace(binders.names()[idx], std::move(inResults[idx])); - } - ExplainPrinter printer; - printer.separator("BindBlock:"); - - for (auto& [name, child] : ordered) { - if constexpr (version < ExplainVersion::V3) { - ExplainPrinter local; - local.print("[").print(name).print("]").print(child); - printer.print(local); - } else if constexpr (version == ExplainVersion::V3) { + if constexpr (version < ExplainVersion::V3) { + // The bind block is redundant for V1-V2 type explains, as the bound projections can be + // inferred from the field projection map; so here we print nothing. + return printer; + } else if constexpr (version == ExplainVersion::V3) { + std::map<ProjectionName, ExplainPrinter> ordered; + for (size_t idx = 0; idx < inResults.size(); ++idx) { + ordered.emplace(binders.names()[idx], std::move(inResults[idx])); + } + printer.separator("BindBlock:"); + for (auto& [name, child] : ordered) { printer.separator(" ").fieldName(name).print(child); - } else { - MONGO_UNREACHABLE; } + } else { + MONGO_UNREACHABLE; } - return printer; } @@ -820,8 +834,13 @@ public: maybePrintProps(printer, node); printer.separator(" [") .fieldName("scanDefName", ExplainVersion::V3) - .print(node.getScanDefName()) - .separator("]"); + .print(node.getScanDefName()); + + if constexpr (version < ExplainVersion::V3) { + printer.separator(", "); + printProjection(printer, node.getProjectionName()); + } + printer.separator("]"); nodeCEPropsPrint(printer, n, node); printer.fieldName("bindings", ExplainVersion::V3).print(bindResult); return printer; @@ -1178,13 +1197,29 @@ public: ExplainPrinter projectionResult) { ExplainPrinter printer("Evaluation"); maybePrintProps(printer, node); - printer.separator(" []"); + printer.separator(" ["); + + // The bind block (projectionResult) is empty in V1-V2 explains. In the case of the + // Evaluation node, the bind block may have useful information about the embedded + // expression, so we make sure to print the projected expression. + if constexpr (version < ExplainVersion::V3) { + printProjection(printer, node.getProjectionName()); + } + + printer.separator("]"); nodeCEPropsPrint(printer, n, node); - printer.setChildCount(2) - .fieldName("projection", ExplainVersion::V3) - .print(projectionResult) - .fieldName("child", ExplainVersion::V3) - .print(childResult); + printer.setChildCount(2); + + if constexpr (version < ExplainVersion::V3) { + auto pathPrinter = generate(node.getProjection()); + printer.print(pathPrinter); + } else if constexpr (version == ExplainVersion::V3) { + printer.fieldName("projection").print(projectionResult); + } else { + MONGO_UNREACHABLE; + } + + printer.fieldName("child", ExplainVersion::V3).print(childResult); return printer; } @@ -1260,7 +1295,13 @@ public: .print(IndexReqTargetEnum::toString[static_cast<int>(node.getTarget())]) .separator("]"); nodeCEPropsPrint(printer, n, node); - printer.setChildCount(scanParams ? 6 : 5); + size_t childCount = scanParams ? 5 : 4; + // In V3 only we include the ref block (see at the end of this function), so V3 has one + // more child. + if constexpr (version == ExplainVersion::V3) { + childCount++; + } + printer.setChildCount(childCount); if constexpr (version < ExplainVersion::V3) { ExplainPrinter local; @@ -1388,12 +1429,11 @@ public: printer.printAppend(scanParamsPrinter); } - printer.fieldName("bindings", ExplainVersion::V3) - .print(bindResult) - .fieldName("references", ExplainVersion::V3) - .print(refsResult) - .fieldName("child", ExplainVersion::V3) - .print(childResult); + printer.fieldName("bindings", ExplainVersion::V3).print(bindResult); + if constexpr (version == ExplainVersion::V3) { + printer.fieldName("references", ExplainVersion::V3).print(refsResult); + } + printer.fieldName("child", ExplainVersion::V3).print(childResult); return printer; } @@ -1448,7 +1488,8 @@ public: maybePrintProps(printer, node); printer.separator(" [") .fieldName("joinType") - .print(JoinTypeEnum::toString[static_cast<int>(node.getJoinType())]); + .print(JoinTypeEnum::toString[static_cast<int>(node.getJoinType())]) + .separator(", "); printCorrelatedProjections(printer, node.getCorrelatedProjectionNames()); @@ -1589,7 +1630,8 @@ public: maybePrintProps(printer, node); printer.separator(" [") .fieldName("joinType") - .print(JoinTypeEnum::toString[static_cast<int>(node.getJoinType())]); + .print(JoinTypeEnum::toString[static_cast<int>(node.getJoinType())]) + .separator(", "); printCorrelatedProjections(printer, node.getCorrelatedProjectionNames()); @@ -1613,7 +1655,13 @@ public: ExplainPrinter /*refsResult*/) { ExplainPrinter printer("Union"); maybePrintProps(printer, node); - printer.separator(" []"); + if (version < ExplainVersion::V3) { + printer.separator(" ["); + printProjections(printer, node.binder().names()); + printer.separator("]"); + } else { + printer.separator(" []"); + } nodeCEPropsPrint(printer, n, node); printer.setChildCount(childResults.size() + 1) .fieldName("bindings", ExplainVersion::V3) @@ -1742,8 +1790,12 @@ public: .print(SpoolProducerTypeEnum::toString[static_cast<int>(node.getType())]) .separator(", ") .fieldName("id") - .print(node.getSpoolId()) - .separator("]"); + .print(node.getSpoolId()); + if (version < ExplainVersion::V3) { + printer.separator(", "); + printProjections(printer, node.binder().names()); + } + printer.separator("]"); nodeCEPropsPrint(printer, n, node); printer.setChildCount(3); @@ -1765,8 +1817,12 @@ public: .print(SpoolConsumerTypeEnum::toString[static_cast<int>(node.getType())]) .separator(", ") .fieldName("id") - .print(node.getSpoolId()) - .separator("]"); + .print(node.getSpoolId()); + if (version < ExplainVersion::V3) { + printer.separator(", "); + printProjections(printer, node.binder().names()); + } + printer.separator("]"); nodeCEPropsPrint(printer, n, node); printer.fieldName("bindings", ExplainVersion::V3).print(bindResult); diff --git a/src/mongo/db/query/optimizer/interval_simplify_test.cpp b/src/mongo/db/query/optimizer/interval_simplify_test.cpp index df47e451f26..002c8e38437 100644 --- a/src/mongo/db/query/optimizer/interval_simplify_test.cpp +++ b/src/mongo/db/query/optimizer/interval_simplify_test.cpp @@ -75,7 +75,7 @@ TEST_F(IntervalIntersection, SingleFieldIntersection) { {"index1", makeIndexDefinition("a0", CollationOp::Ascending, /*Not multikey*/ false)}}; const std::string q1Text = "{a0: {$gt:14, $lt:21}}"; - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" @@ -88,20 +88,14 @@ TEST_F(IntervalIntersection, SingleFieldIntersection) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': scan_0}, coll]\n" - "| | BindBlock:\n" - "| | [scan_0]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: coll, indexDefName: index1, interval: " - "{(Const [14], Const [21])}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: coll, indexDefName: index1, interval: {(Const " + "[14], Const [21])}]\n", optimizedQueryPlan(q1Text, testIndex)); const std::string q2Text = "{$and: [{a0: {$gt:14}}, {a0: {$lt: 21}}]}"; - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" @@ -114,22 +108,16 @@ TEST_F(IntervalIntersection, SingleFieldIntersection) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': scan_0}, coll]\n" - "| | BindBlock:\n" - "| | [scan_0]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: coll, indexDefName: index1, interval: " - "{(Const [14], Const [21])}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: coll, indexDefName: index1, interval: {(Const " + "[14], Const [21])}]\n", optimizedQueryPlan(q2Text, testIndex)); const std::string q3Text = "{$or: [{$and: [{a0: {$gt:9, $lt:999}}, {a0: {$gt: 0, $lt: 12}}]}, {$and: [{a0: {$gt:40, " "$lt:997}}, {a0: {$gt:0, $lt: 44}}]}]}"; - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" @@ -142,9 +130,6 @@ TEST_F(IntervalIntersection, SingleFieldIntersection) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': scan_0}, coll]\n" - "| | BindBlock:\n" - "| | [scan_0]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "GroupBy []\n" @@ -152,34 +137,23 @@ TEST_F(IntervalIntersection, SingleFieldIntersection) { "| | RefBlock: \n" "| | Variable [rid_0]\n" "| aggregations: \n" - "Union []\n" - "| | BindBlock:\n" - "| | [rid_0]\n" - "| | Source []\n" + "Union [{rid_0}]\n" "| IndexScan [{'<rid>': rid_0}, scanDefName: coll, indexDefName: index1, interval: {(Co" "nst [40], Const [44])}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" "IndexScan [{'<rid>': rid_0}, scanDefName: coll, indexDefName: index1, interval: {(Const " - "[9], Const [12])}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "[9], Const [12])}]\n", optimizedQueryPlan(q3Text, testIndex)); // Contradiction: empty interval. const std::string q4Text = "{$and: [{a0: {$gt:20}}, {a0: {$lt: 20}}]}"; - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" "| RefBlock: \n" "| Variable [scan_0]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [scan_0]\n" - "| Const [Nothing]\n" + "Evaluation [{scan_0}]\n" + "| Const [Nothing]\n" "LimitSkip []\n" "| limitSkip:\n" "| limit: 0\n" @@ -191,7 +165,7 @@ TEST_F(IntervalIntersection, SingleFieldIntersection) { const std::string q5Text = "{$or: [{$and: [{a0: {$gt:9}}, {a0: {$lt: 12}}]}, {$and: [{a0: {$gt:44}}, {a0: {$lt: " "40}}]}]}"; - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" @@ -204,32 +178,24 @@ TEST_F(IntervalIntersection, SingleFieldIntersection) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': scan_0}, coll]\n" - "| | BindBlock:\n" - "| | [scan_0]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: coll, indexDefName: index1, interval: " - "{(Const [9], Const [12])}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: coll, indexDefName: index1, interval: {(Const " + "[9], Const [12])}]\n", optimizedQueryPlan(q5Text, testIndex)); // Contradiction: both conjuncts empty, whole disjunct empty. const std::string q6Text = "{$or: [{$and: [{a0: {$gt:15}}, {a0: {$lt: 10}}]}, {$and: [{a0: {$gt:44}}, {a0: {$lt: " "40}}]}]}"; - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" "| RefBlock: \n" "| Variable [scan_0]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [scan_0]\n" - "| Const [Nothing]\n" + "Evaluation [{scan_0}]\n" + "| Const [Nothing]\n" "LimitSkip []\n" "| limitSkip:\n" "| limit: 0\n" @@ -241,16 +207,14 @@ TEST_F(IntervalIntersection, SingleFieldIntersection) { const std::string q7Text = "{$or: [{$and: [{a0: {$gt:12}}, {a0: {$lt: 12}}]}, {$and: [{a0: {$gte:42}}, {a0: {$lt: " "42}}]}]}"; - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" "| RefBlock: \n" "| Variable [scan_0]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [scan_0]\n" - "| Const [Nothing]\n" + "Evaluation [{scan_0}]\n" + "| Const [Nothing]\n" "LimitSkip []\n" "| limitSkip:\n" "| limit: 0\n" @@ -270,16 +234,14 @@ TEST_F(IntervalIntersection, MultiFieldIntersection) { const std::string q1Text = "{$and: [{a0: {$gt: 11}}, {a0: {$lt: 14}}, {b0: {$gt: 21}}, {b0: {$lt: 12}}]}"; - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" "| RefBlock: \n" "| Variable [scan_0]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [scan_0]\n" - "| Const [Nothing]\n" + "Evaluation [{scan_0}]\n" + "| Const [Nothing]\n" "LimitSkip []\n" "| limitSkip:\n" "| limit: 0\n" @@ -289,16 +251,14 @@ TEST_F(IntervalIntersection, MultiFieldIntersection) { const std::string q2Text = "{$and: [{a0: {$gt: 14}}, {a0: {$lt: 11}}, {b0: {$gt: 12}}, {b0: {$lt: 21}}]}"; - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" "| RefBlock: \n" "| Variable [scan_0]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [scan_0]\n" - "| Const [Nothing]\n" + "Evaluation [{scan_0}]\n" + "| Const [Nothing]\n" "LimitSkip []\n" "| limitSkip:\n" "| limit: 0\n" @@ -308,16 +268,14 @@ TEST_F(IntervalIntersection, MultiFieldIntersection) { const std::string q3Text = "{$and: [{a0: {$gt: 14}}, {a0: {$lt: 11}}, {b0: {$gt: 21}}, {b0: {$lt: 12}}]}"; - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" "| RefBlock: \n" "| Variable [scan_0]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [scan_0]\n" - "| Const [Nothing]\n" + "Evaluation [{scan_0}]\n" + "| Const [Nothing]\n" "LimitSkip []\n" "| limitSkip:\n" "| limit: 0\n" @@ -326,16 +284,14 @@ TEST_F(IntervalIntersection, MultiFieldIntersection) { optimizedQueryPlan(q3Text, testIndex)); const std::string q4Text = "{$and: [{a0: 42}, {b0: {$gt: 21}}, {b0: {$lt: 12}}]}"; - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" "| RefBlock: \n" "| Variable [scan_0]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [scan_0]\n" - "| Const [Nothing]\n" + "Evaluation [{scan_0}]\n" + "| Const [Nothing]\n" "LimitSkip []\n" "| limitSkip:\n" "| limit: 0\n" diff --git a/src/mongo/db/query/optimizer/logical_rewriter_optimizer_test.cpp b/src/mongo/db/query/optimizer/logical_rewriter_optimizer_test.cpp index c1694f9c898..9288904a1d6 100644 --- a/src/mongo/db/query/optimizer/logical_rewriter_optimizer_test.cpp +++ b/src/mongo/db/query/optimizer/logical_rewriter_optimizer_test.cpp @@ -54,7 +54,7 @@ TEST(LogicalRewriter, RootNodeMerge) { ABT rootNode = make<RootNode>(properties::ProjectionRequirement{ProjectionNameVector{"a"}}, std::move(limitSkipNode2)); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " a\n" @@ -68,10 +68,7 @@ TEST(LogicalRewriter, RootNodeMerge) { " limitSkip:\n" " limit: (none)\n" " skip: 10\n" - " Scan [test]\n" - " BindBlock:\n" - " [a]\n" - " Source []\n", + " Scan [test, {a}]\n", rootNode); auto phaseManager = makePhaseManager({OptPhase::MemoSubstitutionPhase}, @@ -82,7 +79,7 @@ TEST(LogicalRewriter, RootNodeMerge) { ABT rewritten = std::move(rootNode); phaseManager.optimize(rewritten); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " a\n" @@ -92,10 +89,7 @@ TEST(LogicalRewriter, RootNodeMerge) { " limitSkip:\n" " limit: 5\n" " skip: 10\n" - " Scan [test]\n" - " BindBlock:\n" - " [a]\n" - " Source []\n", + " Scan [test, {a}]\n", rewritten); } @@ -128,7 +122,7 @@ TEST(LogicalRewriter, Memo) { NodeIdSet expectedInsertedNodeIds = {{0, 0}, {1, 0}, {2, 0}}; ASSERT_TRUE(insertedNodeIds == expectedInsertedNodeIds); - ASSERT_EXPLAIN_MEMO( + ASSERT_EXPLAIN_MEMO_AUTO( "Memo: \n" " groupId: 0\n" " | | Logical properties:\n" @@ -145,10 +139,7 @@ TEST(LogicalRewriter, Memo) { " | | type: Centralized\n" " | logicalNodes: \n" " | logicalNodeId: 0, rule: Root\n" - " | Scan [test]\n" - " | BindBlock:\n" - " | [ptest]\n" - " | Source []\n" + " | Scan [test, {ptest}]\n" " physicalNodes: \n" " groupId: 1\n" " | | Logical properties:\n" @@ -189,13 +180,11 @@ TEST(LogicalRewriter, Memo) { " | | type: Centralized\n" " | logicalNodes: \n" " | logicalNodeId: 0, rule: Root\n" - " | Evaluation []\n" - " | | BindBlock:\n" - " | | [P1]\n" - " | | EvalPath []\n" - " | | | Variable [ptest]\n" - " | | PathConstant []\n" - " | | Const [2]\n" + " | Evaluation [{P1}]\n" + " | | EvalPath []\n" + " | | | Variable [ptest]\n" + " | | PathConstant []\n" + " | | Const [2]\n" " | MemoLogicalDelegator [groupId: 1]\n" " physicalNodes: \n", memo); @@ -235,14 +224,12 @@ TEST(LogicalRewriter, Memo) { { ASSERT_EQ(1, memo.getLogicalNodes(3).size()); - ASSERT_EXPLAIN( - "Evaluation []\n" - " BindBlock:\n" - " [P1]\n" - " EvalPath []\n" - " PathConstant []\n" - " Const [2]\n" - " Variable [ptest]\n" + ASSERT_EXPLAIN_AUTO( + "Evaluation [{P1}]\n" + " EvalPath []\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [ptest]\n" " MemoLogicalDelegator [groupId: 0]\n", memo.getLogicalNodes(3).front()); } @@ -264,7 +251,7 @@ TEST(LogicalRewriter, FilterProjectRewrite) { ABT rootNode = make<RootNode>(properties::ProjectionRequirement{{}}, std::move(filterNode)); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " RefBlock: \n" @@ -272,21 +259,16 @@ TEST(LogicalRewriter, FilterProjectRewrite) { " EvalFilter []\n" " PathIdentity []\n" " Variable [P1]\n" - " Evaluation []\n" - " BindBlock:\n" - " [P1]\n" - " EvalPath []\n" - " PathIdentity []\n" - " Variable [ptest]\n" + " Evaluation [{P1}]\n" + " EvalPath []\n" + " PathIdentity []\n" + " Variable [ptest]\n" " Collation []\n" " collation: \n" " ptest: Ascending\n" " RefBlock: \n" " Variable [ptest]\n" - " Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + " Scan [test, {ptest}]\n", rootNode); auto phaseManager = makePhaseManager({OptPhase::MemoSubstitutionPhase}, @@ -297,7 +279,7 @@ TEST(LogicalRewriter, FilterProjectRewrite) { ABT latest = std::move(rootNode); phaseManager.optimize(latest); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " RefBlock: \n" @@ -310,16 +292,11 @@ TEST(LogicalRewriter, FilterProjectRewrite) { " EvalFilter []\n" " PathIdentity []\n" " Variable [P1]\n" - " Evaluation []\n" - " BindBlock:\n" - " [P1]\n" - " EvalPath []\n" - " PathIdentity []\n" - " Variable [ptest]\n" - " Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + " Evaluation [{P1}]\n" + " EvalPath []\n" + " PathIdentity []\n" + " Variable [ptest]\n" + " Scan [test, {ptest}]\n", latest); } @@ -356,7 +333,7 @@ TEST(LogicalRewriter, FilterProjectComplexRewrite) { ABT rootNode = make<RootNode>(properties::ProjectionRequirement{{}}, std::move(filter2Node)); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| RefBlock: \n" @@ -372,33 +349,24 @@ TEST(LogicalRewriter, FilterProjectComplexRewrite) { "| EvalFilter []\n" "| | Variable [p1]\n" "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p1]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" + "Evaluation [{p1}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" "Collation []\n" "| | collation: \n" "| | ptest: Ascending\n" "| RefBlock: \n" "| Variable [ptest]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p3]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p2]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + "Evaluation [{p3}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Evaluation [{p2}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Scan [test, {ptest}]\n", rootNode); auto phaseManager = makePhaseManager({OptPhase::MemoSubstitutionPhase}, @@ -410,7 +378,7 @@ TEST(LogicalRewriter, FilterProjectComplexRewrite) { phaseManager.optimize(latest); // Note: this assert depends on the order on which we consider rewrites. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| RefBlock: \n" @@ -431,28 +399,19 @@ TEST(LogicalRewriter, FilterProjectComplexRewrite) { "| EvalFilter []\n" "| | Variable [p1]\n" "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p1]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p3]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p2]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + "Evaluation [{p1}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Evaluation [{p3}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Evaluation [{p2}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Scan [test, {ptest}]\n", latest); } @@ -488,7 +447,7 @@ TEST(LogicalRewriter, FilterProjectGroupRewrite) { ABT latest = std::move(rootNode); phaseManager.optimize(latest); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | c\n" @@ -501,26 +460,19 @@ TEST(LogicalRewriter, FilterProjectGroupRewrite) { "| aggregations: \n" "| [c]\n" "| Variable [b]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [b]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" + "Evaluation [{b}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" "Filter []\n" "| EvalFilter []\n" "| | Variable [a]\n" "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [a]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + "Evaluation [{a}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Scan [test, {ptest}]\n", latest); } @@ -559,7 +511,7 @@ TEST(LogicalRewriter, FilterProjectUnwindRewrite) { ABT latest = std::move(rootNode); phaseManager.optimize(latest); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | a\n" @@ -576,27 +528,15 @@ TEST(LogicalRewriter, FilterProjectUnwindRewrite) { "| | Variable [a]\n" "| PathIdentity []\n" "Unwind []\n" - "| BindBlock:\n" - "| [a]\n" - "| Source []\n" - "| [a_pid]\n" - "| Source []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [b]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [a]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + "Evaluation [{b}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Evaluation [{a}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Scan [test, {ptest}]\n", latest); } @@ -631,7 +571,7 @@ TEST(LogicalRewriter, FilterProjectExchangeRewrite) { ABT latest = std::move(rootNode); phaseManager.optimize(latest); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | a\n" @@ -639,12 +579,10 @@ TEST(LogicalRewriter, FilterProjectExchangeRewrite) { "| RefBlock: \n" "| Variable [a]\n" "| Variable [b]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [b]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" + "Evaluation [{b}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" "Exchange []\n" "| | distribution: \n" "| | type: HashPartitioning\n" @@ -656,16 +594,11 @@ TEST(LogicalRewriter, FilterProjectExchangeRewrite) { "| EvalFilter []\n" "| | Variable [a]\n" "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [a]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + "Evaluation [{a}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Scan [test, {ptest}]\n", latest); } @@ -704,7 +637,7 @@ TEST(LogicalRewriter, UnwindCollationRewrite) { ABT latest = std::move(rootNode); phaseManager.optimize(latest); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | a\n" @@ -718,27 +651,15 @@ TEST(LogicalRewriter, UnwindCollationRewrite) { "| RefBlock: \n" "| Variable [b]\n" "Unwind []\n" - "| BindBlock:\n" - "| [a]\n" - "| Source []\n" - "| [a_pid]\n" - "| Source []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [b]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [a]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + "Evaluation [{b}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Evaluation [{a}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Scan [test, {ptest}]\n", latest); } @@ -770,7 +691,7 @@ TEST(LogicalRewriter, FilterUnionReorderSingleProjection) { ABT latest = std::move(rootNode); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pUnion\n" @@ -783,30 +704,17 @@ TEST(LogicalRewriter, FilterUnionReorderSingleProjection) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "Union []\n" - "| | BindBlock:\n" - "| | [pUnion]\n" - "| | Source []\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [pUnion]\n" - "| | EvalPath []\n" - "| | | Variable [ptest2]\n" - "| | PathIdentity []\n" - "| Scan [test2]\n" - "| BindBlock:\n" - "| [ptest2]\n" - "| Source []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pUnion]\n" - "| EvalPath []\n" - "| | Variable [ptest1]\n" - "| PathIdentity []\n" - "Scan [test1]\n" - " BindBlock:\n" - " [ptest1]\n" - " Source []\n", + "Union [{pUnion}]\n" + "| Evaluation [{pUnion}]\n" + "| | EvalPath []\n" + "| | | Variable [ptest2]\n" + "| | PathIdentity []\n" + "| Scan [test2, {ptest2}]\n" + "Evaluation [{pUnion}]\n" + "| EvalPath []\n" + "| | Variable [ptest1]\n" + "| PathIdentity []\n" + "Scan [test1, {ptest1}]\n", latest); auto phaseManager = @@ -817,16 +725,13 @@ TEST(LogicalRewriter, FilterUnionReorderSingleProjection) { DebugInfo::kDefaultForTests); phaseManager.optimize(latest); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pUnion\n" "| RefBlock: \n" "| Variable [pUnion]\n" - "Union []\n" - "| | BindBlock:\n" - "| | [pUnion]\n" - "| | Source []\n" + "Union [{pUnion}]\n" "| Filter []\n" "| | EvalFilter []\n" "| | | Variable [pUnion]\n" @@ -834,16 +739,11 @@ TEST(LogicalRewriter, FilterUnionReorderSingleProjection) { "| | PathTraverse [1]\n" "| | PathCompare [Eq]\n" "| | Const [1]\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [pUnion]\n" - "| | EvalPath []\n" - "| | | Variable [ptest2]\n" - "| | PathIdentity []\n" - "| Scan [test2]\n" - "| BindBlock:\n" - "| [ptest2]\n" - "| Source []\n" + "| Evaluation [{pUnion}]\n" + "| | EvalPath []\n" + "| | | Variable [ptest2]\n" + "| | PathIdentity []\n" + "| Scan [test2, {ptest2}]\n" "Filter []\n" "| EvalFilter []\n" "| | Variable [pUnion]\n" @@ -851,16 +751,11 @@ TEST(LogicalRewriter, FilterUnionReorderSingleProjection) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pUnion]\n" - "| EvalPath []\n" - "| | Variable [ptest1]\n" - "| PathIdentity []\n" - "Scan [test1]\n" - " BindBlock:\n" - " [ptest1]\n" - " Source []\n", + "Evaluation [{pUnion}]\n" + "| EvalPath []\n" + "| | Variable [ptest1]\n" + "| PathIdentity []\n" + "Scan [test1, {ptest1}]\n", latest); } @@ -912,7 +807,7 @@ TEST(LogicalRewriter, MultipleFilterUnionReorder) { ABT latest = std::move(rootNode); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pUnion1\n" @@ -934,44 +829,25 @@ TEST(LogicalRewriter, MultipleFilterUnionReorder) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "Union []\n" - "| | BindBlock:\n" - "| | [pUnion1]\n" - "| | Source []\n" - "| | [pUnion2]\n" - "| | Source []\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [pUnion2]\n" - "| | EvalPath []\n" - "| | | Variable [ptest2]\n" - "| | PathIdentity []\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [pUnion1]\n" - "| | EvalPath []\n" - "| | | Variable [ptest2]\n" - "| | PathIdentity []\n" - "| Scan [test2]\n" - "| BindBlock:\n" - "| [ptest2]\n" - "| Source []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pUnion2]\n" - "| EvalPath []\n" - "| | Variable [ptest1]\n" - "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pUnion1]\n" - "| EvalPath []\n" - "| | Variable [ptest1]\n" - "| PathIdentity []\n" - "Scan [test1]\n" - " BindBlock:\n" - " [ptest1]\n" - " Source []\n", + "Union [{pUnion1, pUnion2}]\n" + "| Evaluation [{pUnion2}]\n" + "| | EvalPath []\n" + "| | | Variable [ptest2]\n" + "| | PathIdentity []\n" + "| Evaluation [{pUnion1}]\n" + "| | EvalPath []\n" + "| | | Variable [ptest2]\n" + "| | PathIdentity []\n" + "| Scan [test2, {ptest2}]\n" + "Evaluation [{pUnion2}]\n" + "| EvalPath []\n" + "| | Variable [ptest1]\n" + "| PathIdentity []\n" + "Evaluation [{pUnion1}]\n" + "| EvalPath []\n" + "| | Variable [ptest1]\n" + "| PathIdentity []\n" + "Scan [test1, {ptest1}]\n", latest); auto phaseManager = @@ -982,7 +858,7 @@ TEST(LogicalRewriter, MultipleFilterUnionReorder) { DebugInfo::kDefaultForTests); phaseManager.optimize(latest); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pUnion1\n" @@ -990,12 +866,7 @@ TEST(LogicalRewriter, MultipleFilterUnionReorder) { "| RefBlock: \n" "| Variable [pUnion1]\n" "| Variable [pUnion2]\n" - "Union []\n" - "| | BindBlock:\n" - "| | [pUnion1]\n" - "| | Source []\n" - "| | [pUnion2]\n" - "| | Source []\n" + "Union [{pUnion1, pUnion2}]\n" "| Filter []\n" "| | EvalFilter []\n" "| | | Variable [pUnion2]\n" @@ -1003,12 +874,10 @@ TEST(LogicalRewriter, MultipleFilterUnionReorder) { "| | PathTraverse [1]\n" "| | PathCompare [Eq]\n" "| | Const [1]\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [pUnion2]\n" - "| | EvalPath []\n" - "| | | Variable [ptest2]\n" - "| | PathIdentity []\n" + "| Evaluation [{pUnion2}]\n" + "| | EvalPath []\n" + "| | | Variable [ptest2]\n" + "| | PathIdentity []\n" "| Filter []\n" "| | EvalFilter []\n" "| | | Variable [pUnion1]\n" @@ -1016,16 +885,11 @@ TEST(LogicalRewriter, MultipleFilterUnionReorder) { "| | PathTraverse [1]\n" "| | PathCompare [Eq]\n" "| | Const [1]\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [pUnion1]\n" - "| | EvalPath []\n" - "| | | Variable [ptest2]\n" - "| | PathIdentity []\n" - "| Scan [test2]\n" - "| BindBlock:\n" - "| [ptest2]\n" - "| Source []\n" + "| Evaluation [{pUnion1}]\n" + "| | EvalPath []\n" + "| | | Variable [ptest2]\n" + "| | PathIdentity []\n" + "| Scan [test2, {ptest2}]\n" "Filter []\n" "| EvalFilter []\n" "| | Variable [pUnion2]\n" @@ -1033,12 +897,10 @@ TEST(LogicalRewriter, MultipleFilterUnionReorder) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pUnion2]\n" - "| EvalPath []\n" - "| | Variable [ptest1]\n" - "| PathIdentity []\n" + "Evaluation [{pUnion2}]\n" + "| EvalPath []\n" + "| | Variable [ptest1]\n" + "| PathIdentity []\n" "Filter []\n" "| EvalFilter []\n" "| | Variable [pUnion1]\n" @@ -1046,16 +908,11 @@ TEST(LogicalRewriter, MultipleFilterUnionReorder) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pUnion1]\n" - "| EvalPath []\n" - "| | Variable [ptest1]\n" - "| PathIdentity []\n" - "Scan [test1]\n" - " BindBlock:\n" - " [ptest1]\n" - " Source []\n", + "Evaluation [{pUnion1}]\n" + "| EvalPath []\n" + "| | Variable [ptest1]\n" + "| PathIdentity []\n" + "Scan [test1, {ptest1}]\n", latest); } @@ -1088,7 +945,7 @@ TEST(LogicalRewriter, FilterUnionUnionPushdown) { DebugInfo::kDefaultForTests); ABT latest = std::move(rootNode); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | ptest\n" @@ -1101,95 +958,56 @@ TEST(LogicalRewriter, FilterUnionUnionPushdown) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "Union []\n" - "| | BindBlock:\n" - "| | [ptest]\n" - "| | Source []\n" - "| Scan [test3]\n" - "| BindBlock:\n" - "| [ptest]\n" - "| Source []\n" - "Union []\n" - "| | BindBlock:\n" - "| | [ptest]\n" - "| | Source []\n" - "| Scan [test2]\n" - "| BindBlock:\n" - "| [ptest]\n" - "| Source []\n" - "Scan [test1]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + "Union [{ptest}]\n" + "| Scan [test3, {ptest}]\n" + "Union [{ptest}]\n" + "| Scan [test2, {ptest}]\n" + "Scan [test1, {ptest}]\n", latest); phaseManager.optimize(latest); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | ptest\n" "| RefBlock: \n" "| Variable [ptest]\n" - "Union []\n" - "| | BindBlock:\n" - "| | [ptest]\n" - "| | Source []\n" + "Union [{ptest}]\n" "| Sargable [Complete]\n" - "| | | | | | requirementsMap: \n" - "| | | | | | refProjection: ptest, path: 'PathGet [a] PathTraverse [1] " - "PathIdentity []', intervals: {{{=Const [1]}}}\n" - "| | | | | candidateIndexes: \n" - "| | | | scanParams: \n" - "| | | | {'a': evalTemp_0}\n" - "| | | | residualReqs: \n" - "| | | | refProjection: evalTemp_0, path: 'PathTraverse [1] " - "PathIdentity []', intervals: {{{=Const [1]}}}, entryIndex: 0\n" - "| | | BindBlock:\n" - "| | RefBlock: \n" - "| | Variable [ptest]\n" - "| Scan [test3]\n" - "| BindBlock:\n" - "| [ptest]\n" - "| Source []\n" - "Union []\n" - "| | BindBlock:\n" - "| | [ptest]\n" - "| | Source []\n" + "| | | | | requirementsMap: \n" + "| | | | | refProjection: ptest, path: 'PathGet [a] PathTraverse [1] PathId" + "entity []', intervals: {{{=Const [1]}}}\n" + "| | | | candidateIndexes: \n" + "| | | scanParams: \n" + "| | | {'a': evalTemp_0}\n" + "| | | residualReqs: \n" + "| | | refProjection: evalTemp_0, path: 'PathTraverse [1] PathIdentity " + "[]', intervals: {{{=Const [1]}}}, entryIndex: 0\n" + "| Scan [test3, {ptest}]\n" + "Union [{ptest}]\n" "| Sargable [Complete]\n" - "| | | | | | requirementsMap: \n" - "| | | | | | refProjection: ptest, path: 'PathGet [a] PathTraverse [1] " - "PathIdentity []', intervals: {{{=Const [1]}}}\n" - "| | | | | candidateIndexes: \n" - "| | | | scanParams: \n" - "| | | | {'a': evalTemp_2}\n" - "| | | | residualReqs: \n" - "| | | | refProjection: evalTemp_2, path: 'PathTraverse [1] " - "PathIdentity []', intervals: {{{=Const [1]}}}, entryIndex: 0\n" - "| | | BindBlock:\n" - "| | RefBlock: \n" - "| | Variable [ptest]\n" - "| Scan [test2]\n" - "| BindBlock:\n" - "| [ptest]\n" - "| Source []\n" - "Sargable [Complete]\n" "| | | | | requirementsMap: \n" - "| | | | | refProjection: ptest, path: 'PathGet [a] PathTraverse [1] " - "PathIdentity []', intervals: {{{=Const [1]}}}\n" + "| | | | | refProjection: ptest, path: 'PathGet [a] PathTraverse [1] PathId" + "entity []', intervals: {{{=Const [1]}}}\n" "| | | | candidateIndexes: \n" "| | | scanParams: \n" - "| | | {'a': evalTemp_1}\n" + "| | | {'a': evalTemp_2}\n" "| | | residualReqs: \n" - "| | | refProjection: evalTemp_1, path: 'PathTraverse [1] PathIdentity " + "| | | refProjection: evalTemp_2, path: 'PathTraverse [1] PathIdentity " "[]', intervals: {{{=Const [1]}}}, entryIndex: 0\n" - "| | BindBlock:\n" - "| RefBlock: \n" - "| Variable [ptest]\n" - "Scan [test1]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + "| Scan [test2, {ptest}]\n" + "Sargable [Complete]\n" + "| | | | requirementsMap: \n" + "| | | | refProjection: ptest, path: 'PathGet [a] PathTraverse [1] PathIdenti" + "ty []', intervals: {{{=Const [1]}}}\n" + "| | | candidateIndexes: \n" + "| | scanParams: \n" + "| | {'a': evalTemp_1}\n" + "| | residualReqs: \n" + "| | refProjection: evalTemp_1, path: 'PathTraverse [1] PathIdentity []'," + " intervals: {{{=Const [1]}}}, entryIndex: 0\n" + "Scan [test1, {ptest}]\n", latest); } @@ -1236,7 +1054,7 @@ TEST(LogicalRewriter, UnionPreservesCommonLogicalProps) { ABT optimized = rootNode; phaseManager.optimize(optimized); - ASSERT_EXPLAIN_MEMO( + ASSERT_EXPLAIN_MEMO_AUTO( "Memo: \n" " groupId: 0\n" " | | Logical properties:\n" @@ -1245,8 +1063,8 @@ TEST(LogicalRewriter, UnionPreservesCommonLogicalProps) { " | | projections: \n" " | | ptest1\n" " | | indexingAvailability: \n" - " | | [groupId: 0, scanProjection: ptest1, scanDefName: test1, " - "eqPredsOnly]\n" + " | | [groupId: 0, scanProjection: ptest1, scanDefName: test1, eqPredsOnly" + "]\n" " | | collectionAvailability: \n" " | | test1\n" " | | distributionAvailability: \n" @@ -1254,10 +1072,7 @@ TEST(LogicalRewriter, UnionPreservesCommonLogicalProps) { " | | type: UnknownPartitioning\n" " | logicalNodes: \n" " | logicalNodeId: 0, rule: Root\n" - " | Scan [test1]\n" - " | BindBlock:\n" - " | [ptest1]\n" - " | Source []\n" + " | Scan [test1, {ptest1}]\n" " physicalNodes: \n" " groupId: 1\n" " | | Logical properties:\n" @@ -1287,17 +1102,12 @@ TEST(LogicalRewriter, UnionPreservesCommonLogicalProps) { " | logicalNodes: \n" " | logicalNodeId: 0, rule: Root\n" " | Sargable [Complete]\n" - " | | | | | | requirementsMap: \n" - " | | | | | | refProjection: ptest1, path: 'PathGet [a] " - "PathIdentity []', boundProjection: a, intervals: {{{<fully open>}}}\n" - " | | | | | candidateIndexes: \n" - " | | | | scanParams: \n" - " | | | | {'a': a}\n" - " | | | BindBlock:\n" - " | | | [a]\n" - " | | | Source []\n" - " | | RefBlock: \n" - " | | Variable [ptest1]\n" + " | | | | | requirementsMap: \n" + " | | | | | refProjection: ptest1, path: 'PathGet [a] PathIdenti" + "ty []', boundProjection: a, intervals: {{{<fully open>}}}\n" + " | | | | candidateIndexes: \n" + " | | | scanParams: \n" + " | | | {'a': a}\n" " | MemoLogicalDelegator [groupId: 0]\n" " physicalNodes: \n" " groupId: 2\n" @@ -1307,8 +1117,8 @@ TEST(LogicalRewriter, UnionPreservesCommonLogicalProps) { " | | projections: \n" " | | ptest2\n" " | | indexingAvailability: \n" - " | | [groupId: 2, scanProjection: ptest2, scanDefName: test2, " - "eqPredsOnly]\n" + " | | [groupId: 2, scanProjection: ptest2, scanDefName: test2, eqPredsOnly" + "]\n" " | | collectionAvailability: \n" " | | test2\n" " | | distributionAvailability: \n" @@ -1316,10 +1126,7 @@ TEST(LogicalRewriter, UnionPreservesCommonLogicalProps) { " | | type: UnknownPartitioning\n" " | logicalNodes: \n" " | logicalNodeId: 0, rule: Root\n" - " | Scan [test2]\n" - " | BindBlock:\n" - " | [ptest2]\n" - " | Source []\n" + " | Scan [test2, {ptest2}]\n" " physicalNodes: \n" " groupId: 3\n" " | | Logical properties:\n" @@ -1349,17 +1156,12 @@ TEST(LogicalRewriter, UnionPreservesCommonLogicalProps) { " | logicalNodes: \n" " | logicalNodeId: 0, rule: Root\n" " | Sargable [Complete]\n" - " | | | | | | requirementsMap: \n" - " | | | | | | refProjection: ptest2, path: 'PathGet [a] " - "PathIdentity []', boundProjection: a, intervals: {{{<fully open>}}}\n" - " | | | | | candidateIndexes: \n" - " | | | | scanParams: \n" - " | | | | {'a': a}\n" - " | | | BindBlock:\n" - " | | | [a]\n" - " | | | Source []\n" - " | | RefBlock: \n" - " | | Variable [ptest2]\n" + " | | | | | requirementsMap: \n" + " | | | | | refProjection: ptest2, path: 'PathGet [a] PathIdenti" + "ty []', boundProjection: a, intervals: {{{<fully open>}}}\n" + " | | | | candidateIndexes: \n" + " | | | scanParams: \n" + " | | | {'a': a}\n" " | MemoLogicalDelegator [groupId: 2]\n" " physicalNodes: \n" " groupId: 4\n" @@ -1384,10 +1186,7 @@ TEST(LogicalRewriter, UnionPreservesCommonLogicalProps) { " | | type: UnknownPartitioning\n" " | logicalNodes: \n" " | logicalNodeId: 0, rule: Root\n" - " | Union []\n" - " | | | BindBlock:\n" - " | | | [a]\n" - " | | | Source []\n" + " | Union [{a}]\n" " | | MemoLogicalDelegator [groupId: 3]\n" " | MemoLogicalDelegator [groupId: 1]\n" " physicalNodes: \n" @@ -1454,7 +1253,7 @@ TEST(LogicalRewriter, SargableCE) { phaseManager.optimize(latest); // Displays SargableNode-specific per-key estimates. - ASSERT_EXPLAIN_MEMO( + ASSERT_EXPLAIN_MEMO_AUTO( "Memo: \n" " groupId: 0\n" " | | Logical properties:\n" @@ -1471,20 +1270,17 @@ TEST(LogicalRewriter, SargableCE) { " | | type: Centralized\n" " | logicalNodes: \n" " | logicalNodeId: 0, rule: Root\n" - " | Scan [test]\n" - " | BindBlock:\n" - " | [ptest]\n" - " | Source []\n" + " | Scan [test, {ptest}]\n" " physicalNodes: \n" " groupId: 1\n" " | | Logical properties:\n" " | | cardinalityEstimate: \n" " | | ce: 5.62341\n" " | | requirementCEs: \n" - " | | refProjection: ptest, path: 'PathGet [a] PathIdentity []', ce: " - "31.6228\n" - " | | refProjection: ptest, path: 'PathGet [b] PathIdentity []', ce: " - "31.6228\n" + " | | refProjection: ptest, path: 'PathGet [a] PathIdentity []', ce: 3" + "1.6228\n" + " | | refProjection: ptest, path: 'PathGet [b] PathIdentity []', ce: 3" + "1.6228\n" " | | projections: \n" " | | ptest\n" " | | indexingAvailability: \n" @@ -1498,22 +1294,19 @@ TEST(LogicalRewriter, SargableCE) { " | logicalNodes: \n" " | logicalNodeId: 0, rule: Root\n" " | Sargable [Complete]\n" - " | | | | | | requirementsMap: \n" - " | | | | | | refProjection: ptest, path: 'PathGet [a] " - "PathIdentity []', intervals: {{{=Const [1]}}}\n" - " | | | | | | refProjection: ptest, path: 'PathGet [b] " - "PathIdentity []', intervals: {{{=Const [2]}}}\n" - " | | | | | candidateIndexes: \n" - " | | | | scanParams: \n" - " | | | | {'a': evalTemp_2, 'b': evalTemp_3}\n" - " | | | | residualReqs: \n" - " | | | | refProjection: evalTemp_2, path: 'PathIdentity " - "[]', intervals: {{{=Const [1]}}}, entryIndex: 0\n" - " | | | | refProjection: evalTemp_3, path: 'PathIdentity " - "[]', intervals: {{{=Const [2]}}}, entryIndex: 1\n" - " | | | BindBlock:\n" - " | | RefBlock: \n" - " | | Variable [ptest]\n" + " | | | | | requirementsMap: \n" + " | | | | | refProjection: ptest, path: 'PathGet [a] PathIdentit" + "y []', intervals: {{{=Const [1]}}}\n" + " | | | | | refProjection: ptest, path: 'PathGet [b] PathIdentit" + "y []', intervals: {{{=Const [2]}}}\n" + " | | | | candidateIndexes: \n" + " | | | scanParams: \n" + " | | | {'a': evalTemp_2, 'b': evalTemp_3}\n" + " | | | residualReqs: \n" + " | | | refProjection: evalTemp_2, path: 'PathIdentity []', " + "intervals: {{{=Const [1]}}}, entryIndex: 0\n" + " | | | refProjection: evalTemp_3, path: 'PathIdentity []', " + "intervals: {{{=Const [2]}}}, entryIndex: 1\n" " | MemoLogicalDelegator [groupId: 0]\n" " physicalNodes: \n" " groupId: 2\n" @@ -1564,16 +1357,13 @@ TEST(LogicalRewriter, RemoveNoopFilter) { ABT latest = std::move(rootNode); phaseManager.optimize(latest); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | ptest\n" "| RefBlock: \n" "| Variable [ptest]\n" - "Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + "Scan [test, {ptest}]\n", latest); } @@ -1619,7 +1409,7 @@ TEST(LogicalRewriter, NotPushdownToplevelSuccess) { phaseManager.optimize(latest); // We remove the Traverse nodes, and combine the Not ... Eq into Neq. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" @@ -1632,10 +1422,7 @@ TEST(LogicalRewriter, NotPushdownToplevelSuccess) { "| PathGet [b]\n" "| PathCompare [Neq]\n" "| Const [3]\n" - "Scan [coll]\n" - " BindBlock:\n" - " [scan_0]\n" - " Source []\n", + "Scan [coll, {scan_0}]\n", latest); } @@ -1682,7 +1469,7 @@ TEST(LogicalRewriter, NotPushdownToplevelFailureMultikey) { // Because the index is multikey, we don't remove the Traverse nodes, // which prevents us from pushing down the Not. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" @@ -1698,10 +1485,7 @@ TEST(LogicalRewriter, NotPushdownToplevelFailureMultikey) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [3]\n" - "Scan [coll]\n" - " BindBlock:\n" - " [scan_0]\n" - " Source []\n", + "Scan [coll, {scan_0}]\n", latest); } @@ -1734,7 +1518,7 @@ TEST(LogicalRewriter, NotPushdownComposeM) { // We should push the Not down as far as possible, so that some leaves become Neq. // Leaves with a Traverse in the way residualize a Not instead. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" @@ -1764,10 +1548,7 @@ TEST(LogicalRewriter, NotPushdownComposeM) { "| PathGet [a]\n" "| PathCompare [Neq]\n" "| Const [2]\n" - "Scan [coll]\n" - " BindBlock:\n" - " [scan_0]\n" - " Source []\n", + "Scan [coll, {scan_0}]\n", latest); } @@ -1820,7 +1601,7 @@ TEST(LogicalRewriter, NotPushdownUnderLambdaSuccess) { phaseManager.optimize(latest); // All the Traverses should be eliminated, and the Not ... Eq combined as Neq. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" @@ -1834,22 +1615,16 @@ TEST(LogicalRewriter, NotPushdownUnderLambdaSuccess) { "| PathCompare [Neq]\n" "| Const [2]\n" "Sargable [Complete]\n" - "| | | | | requirementsMap: \n" - "| | | | | refProjection: scan_0, path: 'PathGet [a] PathIdentity []', inte" - "rvals: {{{[Const [[]], Const [BinData(0, )])}}}\n" - "| | | | candidateIndexes: \n" - "| | | scanParams: \n" - "| | | {'a': evalTemp_2}\n" - "| | | residualReqs: \n" - "| | | refProjection: evalTemp_2, path: 'PathIdentity []', intervals: {" - "{{[Const [[]], Const [BinData(0, )])}}}, entryIndex: 0\n" - "| | BindBlock:\n" - "| RefBlock: \n" - "| Variable [scan_0]\n" - "Scan [coll]\n" - " BindBlock:\n" - " [scan_0]\n" - " Source []\n", + "| | | | requirementsMap: \n" + "| | | | refProjection: scan_0, path: 'PathGet [a] PathIdentity []', interval" + "s: {{{[Const [[]], Const [BinData(0, )])}}}\n" + "| | | candidateIndexes: \n" + "| | scanParams: \n" + "| | {'a': evalTemp_2}\n" + "| | residualReqs: \n" + "| | refProjection: evalTemp_2, path: 'PathIdentity []', intervals: {{{[C" + "onst [[]], Const [BinData(0, )])}}}, entryIndex: 0\n" + "Scan [coll, {scan_0}]\n", latest); } @@ -1907,7 +1682,7 @@ TEST(LogicalRewriter, NotPushdownUnderLambdaKeepOuterTraverse) { // The inner Traverses should be eliminated, and the Not ... Eq combined as Neq. // We have to keep the outer traverse since 'a' is multikey. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" @@ -1926,24 +1701,18 @@ TEST(LogicalRewriter, NotPushdownUnderLambdaKeepOuterTraverse) { "| | PathObj []\n" "| PathArr []\n" "Sargable [Complete]\n" - "| | | | | requirementsMap: \n" - "| | | | | refProjection: scan_0, path: 'PathGet [a] PathIdentity []', " - "intervals: {{{[Const [[]], Const [BinData(0, )])}}}\n" - "| | | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] " - "PathIdentity []', intervals: {{{[Const [{}], Const [BinData(0, )])}}}, perfOnly\n" - "| | | | candidateIndexes: \n" - "| | | scanParams: \n" - "| | | {'a': evalTemp_1}\n" - "| | | residualReqs: \n" - "| | | refProjection: evalTemp_1, path: 'PathIdentity []', intervals: " - "{{{[Const [[]], Const [BinData(0, )])}}}, entryIndex: 0\n" - "| | BindBlock:\n" - "| RefBlock: \n" - "| Variable [scan_0]\n" - "Scan [coll]\n" - " BindBlock:\n" - " [scan_0]\n" - " Source []\n", + "| | | | requirementsMap: \n" + "| | | | refProjection: scan_0, path: 'PathGet [a] PathIdentity []', interval" + "s: {{{[Const [[]], Const [BinData(0, )])}}}\n" + "| | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] PathIdent" + "ity []', intervals: {{{[Const [{}], Const [BinData(0, )])}}}, perfOnly\n" + "| | | candidateIndexes: \n" + "| | scanParams: \n" + "| | {'a': evalTemp_1}\n" + "| | residualReqs: \n" + "| | refProjection: evalTemp_1, path: 'PathIdentity []', intervals: {{{[C" + "onst [[]], Const [BinData(0, )])}}}, entryIndex: 0\n" + "Scan [coll, {scan_0}]\n", latest); } @@ -1981,7 +1750,7 @@ TEST(LogicalRewriter, NotPushdownUnderLambdaFailsWithFreeVar) { // The Not should be gone: combined into Neq. // But the Lambda [x] should still be there, because 'x' is still used. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" @@ -1997,10 +1766,7 @@ TEST(LogicalRewriter, NotPushdownUnderLambdaFailsWithFreeVar) { "| | Variable [x]\n" "| PathCompare [Neq]\n" "| Variable [x]\n" - "Scan [coll]\n" - " BindBlock:\n" - " [scan_0]\n" - " Source []\n", + "Scan [coll, {scan_0}]\n", latest); } @@ -2056,24 +1822,18 @@ TEST(LogicalRewriter, RemoveTraverseSplitComposeM) { "| RefBlock: \n" "| Variable [scan_0]\n" "Sargable [Complete]\n" - "| | | | | requirementsMap: \n" - "| | | | | refProjection: scan_0, path: 'PathGet [a] PathGet [b] " - "PathIdentity []', intervals: {{{(Const [3], Const [8])}}}\n" - "| | | | candidateIndexes: \n" - "| | | | candidateId: 1, index1, {}, {SimpleInequality}, {{{(Const [3], Const" - " [8])}}}\n" - "| | | scanParams: \n" - "| | | {'a': evalTemp_2}\n" - "| | | residualReqs: \n" - "| | | refProjection: evalTemp_2, path: 'PathGet [b] PathIdentity []', " - "intervals: {{{(Const [3], Const [8])}}}, entryIndex: 0\n" - "| | BindBlock:\n" - "| RefBlock: \n" - "| Variable [scan_0]\n" - "Scan [coll]\n" - " BindBlock:\n" - " [scan_0]\n" - " Source []\n", + "| | | | requirementsMap: \n" + "| | | | refProjection: scan_0, path: 'PathGet [a] PathGet [b] PathIdentity [" + "]', intervals: {{{(Const [3], Const [8])}}}\n" + "| | | candidateIndexes: \n" + "| | | candidateId: 1, index1, {}, {SimpleInequality}, {{{(Const [3], Const [8]" + ")}}}\n" + "| | scanParams: \n" + "| | {'a': evalTemp_2}\n" + "| | residualReqs: \n" + "| | refProjection: evalTemp_2, path: 'PathGet [b] PathIdentity []', inte" + "rvals: {{{(Const [3], Const [8])}}}, entryIndex: 0\n" + "Scan [coll, {scan_0}]\n", latest); } @@ -2132,7 +1892,7 @@ TEST(LogicalRewriter, TraverseComposeMTraverse) { // - Keep the innermost because we don't know anything about the contents // of doubly-nested arrays. // (We may also get a perfOnly Sargable node; that's not the point of this test.) - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | scan_0\n" @@ -2153,22 +1913,16 @@ TEST(LogicalRewriter, TraverseComposeMTraverse) { "| | PathObj []\n" "| PathArr []\n" "Sargable [Complete]\n" - "| | | | | requirementsMap: \n" - "| | | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] " - "PathIdentity []', intervals: {{{[Const [{}], Const [BinData(0, )])}}}, perfOnly\n" - "| | | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] " - "PathTraverse [1] PathGet [b] PathTraverse [1] PathIdentity []', intervals: {{{>Const " - "[3]}}}, perfOnly\n" - "| | | | candidateIndexes: \n" - "| | | scanParams: \n" - "| | | {}\n" - "| | BindBlock:\n" - "| RefBlock: \n" - "| Variable [scan_0]\n" - "Scan [coll]\n" - " BindBlock:\n" - " [scan_0]\n" - " Source []\n", + "| | | | requirementsMap: \n" + "| | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] PathIdent" + "ity []', intervals: {{{[Const [{}], Const [BinData(0, )])}}}, perfOnly\n" + "| | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] PathTrave" + "rse [1] PathGet [b] PathTraverse [1] PathIdentity []', intervals: {{{>Const [3]}}}, perf" + "Only\n" + "| | | candidateIndexes: \n" + "| | scanParams: \n" + "| | {}\n" + "Scan [coll, {scan_0}]\n", latest); } @@ -2220,7 +1974,7 @@ TEST(LogicalRewriter, RelaxComposeM) { ABT optimized = rootNode; phaseManager.optimize(optimized); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -2245,19 +1999,13 @@ TEST(LogicalRewriter, RelaxComposeM) { "| PathCompare [Gt]\n" "| Const [0]\n" "Sargable [Complete]\n" - "| | | | | requirementsMap: \n" - "| | | | | refProjection: root, path: 'PathGet [a] PathTraverse [1] PathGet" - " [b] PathIdentity []', intervals: {{{>Const [0]}}}, perfOnly\n" - "| | | | candidateIndexes: \n" - "| | | scanParams: \n" - "| | | {}\n" - "| | BindBlock:\n" - "| RefBlock: \n" - "| Variable [root]\n" - "Scan [c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "| | | | requirementsMap: \n" + "| | | | refProjection: root, path: 'PathGet [a] PathTraverse [1] PathGet [b]" + " PathIdentity []', intervals: {{{>Const [0]}}}, perfOnly\n" + "| | | candidateIndexes: \n" + "| | scanParams: \n" + "| | {}\n" + "Scan [c1, {root}]\n", optimized); } @@ -2461,19 +2209,13 @@ TEST(LogicalRewriter, EmptyArrayIndexBounds) { "| PathCompare [Eq]\n" "| Const [[]]\n" "Sargable [Complete]\n" - "| | | | | requirementsMap: \n" - "| | | | | refProjection: root, path: 'PathGet [a] PathTraverse [1] PathIde" - "ntity []', intervals: {{{=Const [undefined]}} U {{=Const [[]]}}}, perfOnly\n" - "| | | | candidateIndexes: \n" - "| | | scanParams: \n" - "| | | {}\n" - "| | BindBlock:\n" - "| RefBlock: \n" - "| Variable [root]\n" - "Scan [c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "| | | | requirementsMap: \n" + "| | | | refProjection: root, path: 'PathGet [a] PathTraverse [1] PathIdentit" + "y []', intervals: {{{=Const [undefined]}} U {{=Const [[]]}}}, perfOnly\n" + "| | | candidateIndexes: \n" + "| | scanParams: \n" + "| | {}\n" + "Scan [c1, {root}]\n", rootNode); } diff --git a/src/mongo/db/query/optimizer/optimizer_test.cpp b/src/mongo/db/query/optimizer/optimizer_test.cpp index 2e278f2e90b..c2464d0029c 100644 --- a/src/mongo/db/query/optimizer/optimizer_test.cpp +++ b/src/mongo/db/query/optimizer/optimizer_test.cpp @@ -231,20 +231,14 @@ TEST(Optimizer, Tracker4) { TEST(Optimizer, RefExplain) { ABT scanNode = make<ScanNode>("ptest", "test"); - ASSERT_EXPLAIN( - "Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + ASSERT_EXPLAIN_AUTO( // NOLINT (test auto-update) + "Scan [test, {ptest}]\n", // NOLINT (test auto-update) scanNode); // Now repeat for the reference type. auto ref = scanNode.ref(); - ASSERT_EXPLAIN( - "Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + ASSERT_EXPLAIN_AUTO( // NOLINT (test auto-update) + "Scan [test, {ptest}]\n", // NOLINT (test auto-update) ref); ASSERT_EQ(scanNode.tagOf(), ref.tagOf()); @@ -269,11 +263,8 @@ TEST(Optimizer, CoScan) { TEST(Optimizer, Basic) { ABT scanNode = make<ScanNode>("ptest", "test"); - ASSERT_EXPLAIN( - "Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + ASSERT_EXPLAIN_AUTO( // NOLINT (test auto-update) + "Scan [test, {ptest}]\n", // NOLINT (test auto-update) scanNode); ABT filterNode = make<FilterNode>( @@ -289,7 +280,7 @@ TEST(Optimizer, Basic) { make<RootNode>(properties::ProjectionRequirement{ProjectionNameVector{"P1", "ptest"}}, std::move(evalNode)); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " P1\n" @@ -297,28 +288,23 @@ TEST(Optimizer, Basic) { " RefBlock: \n" " Variable [P1]\n" " Variable [ptest]\n" - " Evaluation []\n" - " BindBlock:\n" - " [P1]\n" - " EvalPath []\n" - " PathConstant []\n" - " Const [2]\n" - " Variable [ptest]\n" + " Evaluation [{P1}]\n" + " EvalPath []\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [ptest]\n" " Filter []\n" " EvalFilter []\n" " PathConstant []\n" " UnaryOp [Neg]\n" " Const [1]\n" " Variable [ptest]\n" - " Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + " Scan [test, {ptest}]\n", rootNode); ABT clonedNode = rootNode; - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " P1\n" @@ -326,23 +312,18 @@ TEST(Optimizer, Basic) { " RefBlock: \n" " Variable [P1]\n" " Variable [ptest]\n" - " Evaluation []\n" - " BindBlock:\n" - " [P1]\n" - " EvalPath []\n" - " PathConstant []\n" - " Const [2]\n" - " Variable [ptest]\n" + " Evaluation [{P1}]\n" + " EvalPath []\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [ptest]\n" " Filter []\n" " EvalFilter []\n" " PathConstant []\n" " UnaryOp [Neg]\n" " Const [1]\n" " Variable [ptest]\n" - " Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + " Scan [test, {ptest}]\n", clonedNode); auto env = VariableEnvironment::build(rootNode); @@ -377,7 +358,7 @@ TEST(Optimizer, GroupBy) { properties::ProjectionRequirement{ProjectionNameVector{"p1", "p2", "a1", "a2"}}, std::move(groupByNode)); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " p1\n" @@ -399,22 +380,13 @@ TEST(Optimizer, GroupBy) { " Const [10]\n" " [a2]\n" " Const [11]\n" - " Evaluation []\n" - " BindBlock:\n" - " [p3]\n" - " Const [3]\n" - " Evaluation []\n" - " BindBlock:\n" - " [p2]\n" - " Const [2]\n" - " Evaluation []\n" - " BindBlock:\n" - " [p1]\n" - " Const [1]\n" - " Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + " Evaluation [{p3}]\n" + " Const [3]\n" + " Evaluation [{p2}]\n" + " Const [2]\n" + " Evaluation [{p1}]\n" + " Const [1]\n" + " Scan [test, {ptest}]\n", rootNode); { @@ -454,7 +426,7 @@ TEST(Optimizer, Union) { ASSERT(!env.hasFreeVariables()); } - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " ptest\n" @@ -462,43 +434,21 @@ TEST(Optimizer, Union) { " RefBlock: \n" " Variable [B]\n" " Variable [ptest]\n" - " Union []\n" - " BindBlock:\n" - " [B]\n" - " Source []\n" - " [ptest]\n" - " Source []\n" - " Evaluation []\n" - " BindBlock:\n" - " [B]\n" - " Const [3]\n" - " Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n" - " Evaluation []\n" - " BindBlock:\n" - " [B]\n" - " Const [4]\n" - " Scan [test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n" - " Evaluation []\n" - " BindBlock:\n" - " [B]\n" - " Const [5]\n" - " Evaluation []\n" - " BindBlock:\n" - " [ptest]\n" - " EvalPath []\n" - " PathConstant []\n" - " Const [2]\n" - " Variable [ptest1]\n" - " Scan [test]\n" - " BindBlock:\n" - " [ptest1]\n" - " Source []\n", + " Union [{B, ptest}]\n" + " Evaluation [{B}]\n" + " Const [3]\n" + " Scan [test, {ptest}]\n" + " Evaluation [{B}]\n" + " Const [4]\n" + " Scan [test, {ptest}]\n" + " Evaluation [{B}]\n" + " Const [5]\n" + " Evaluation [{ptest}]\n" + " EvalPath []\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [ptest1]\n" + " Scan [test, {ptest1}]\n", rootNode); } @@ -539,7 +489,7 @@ TEST(Optimizer, Unwind) { ASSERT(!env.hasFreeVariables()); } - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " p1\n" @@ -550,22 +500,12 @@ TEST(Optimizer, Unwind) { " Variable [p2]\n" " Variable [p2pid]\n" " Unwind [retainNonArrays]\n" - " BindBlock:\n" - " [p2]\n" - " Source []\n" - " [p2pid]\n" - " Source []\n" - " Evaluation []\n" - " BindBlock:\n" - " [p2]\n" - " EvalPath []\n" - " PathConstant []\n" - " Const [2]\n" - " Variable [p1]\n" - " Scan [test]\n" - " BindBlock:\n" - " [p1]\n" - " Source []\n", + " Evaluation [{p2}]\n" + " EvalPath []\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [p1]\n" + " Scan [test, {p1}]\n", rootNode); } @@ -588,7 +528,7 @@ TEST(Optimizer, Collation) { ASSERT(!env.hasFreeVariables()); } - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Collation []\n" " collation: \n" " a: Ascending\n" @@ -596,17 +536,12 @@ TEST(Optimizer, Collation) { " RefBlock: \n" " Variable [a]\n" " Variable [b]\n" - " Evaluation []\n" - " BindBlock:\n" - " [b]\n" - " EvalPath []\n" - " PathConstant []\n" - " Const [2]\n" - " Variable [a]\n" - " Scan [test]\n" - " BindBlock:\n" - " [a]\n" - " Source []\n", + " Evaluation [{b}]\n" + " EvalPath []\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [a]\n" + " Scan [test, {a}]\n", collationNode); } @@ -627,22 +562,17 @@ TEST(Optimizer, LimitSkip) { ASSERT(!env.hasFreeVariables()); } - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "LimitSkip []\n" " limitSkip:\n" " limit: 10\n" " skip: 20\n" - " Evaluation []\n" - " BindBlock:\n" - " [b]\n" - " EvalPath []\n" - " PathConstant []\n" - " Const [2]\n" - " Variable [a]\n" - " Scan [test]\n" - " BindBlock:\n" - " [a]\n" - " Source []\n", + " Evaluation [{b}]\n" + " EvalPath []\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [a]\n" + " Scan [test, {a}]\n", limitSkipNode); } @@ -657,7 +587,7 @@ TEST(Optimizer, Distribution) { properties::DistributionRequirement({DistributionType::HashPartitioning, {"b"}}), std::move(evalNode)); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Exchange []\n" " distribution: \n" " type: HashPartitioning\n" @@ -665,17 +595,12 @@ TEST(Optimizer, Distribution) { " b\n" " RefBlock: \n" " Variable [b]\n" - " Evaluation []\n" - " BindBlock:\n" - " [b]\n" - " EvalPath []\n" - " PathConstant []\n" - " Const [2]\n" - " Variable [a]\n" - " Scan [test]\n" - " BindBlock:\n" - " [a]\n" - " Source []\n", + " Evaluation [{b}]\n" + " EvalPath []\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [a]\n" + " Scan [test, {a}]\n", exchangeNode); } @@ -732,19 +657,14 @@ TEST(Explain, ExplainV2Compact) { ABT evalNode = make<EvaluationNode>( "x2", make<EvalPath>(pathNode, make<Variable>("a")), std::move(scanNode)); - ASSERT_EXPLAIN_V2Compact( - "Evaluation []\n" - "| BindBlock:\n" - "| [x2]\n" - "| EvalPath []\n" - "| | Variable [a]\n" - "| PathGet [a] PathTraverse [1] PathComposeM []\n" - "| | PathCompare [Lt] Const [7]\n" - "| PathCompare [Gte] UnaryOp [Neg] Const [2]\n" - "Scan [test]\n" - " BindBlock:\n" - " [x1]\n" - " Source []\n", + ASSERT_EXPLAIN_V2Compact_AUTO( + "Evaluation [{x2}]\n" + "| EvalPath []\n" + "| | Variable [a]\n" + "| PathGet [a] PathTraverse [1] PathComposeM []\n" + "| | PathCompare [Lt] Const [7]\n" + "| PathCompare [Gte] UnaryOp [Neg] Const [2]\n" + "Scan [test, {x1}]\n", evalNode); } @@ -886,17 +806,14 @@ TEST(Optimizer, ExplainRIDUnion) { ABT rootNode = make<RootNode>(properties::ProjectionRequirement{ProjectionNameVector{"root"}}, std::move(unionNode)); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" "| RefBlock: \n" "| Variable [root]\n" "RIDUnion [root]\n" - "| Scan [c1]\n" - "| BindBlock:\n" - "| [root]\n" - "| Source []\n" + "| Scan [c1, {root}]\n" "Filter []\n" "| EvalFilter []\n" "| | Variable [root]\n" @@ -904,10 +821,7 @@ TEST(Optimizer, ExplainRIDUnion) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "Scan [c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "Scan [c1, {root}]\n", rootNode); } diff --git a/src/mongo/db/query/optimizer/physical_rewriter_optimizer_test.cpp b/src/mongo/db/query/optimizer/physical_rewriter_optimizer_test.cpp index b7a62a4682f..09c8b30a5f3 100644 --- a/src/mongo/db/query/optimizer/physical_rewriter_optimizer_test.cpp +++ b/src/mongo/db/query/optimizer/physical_rewriter_optimizer_test.cpp @@ -83,7 +83,7 @@ TEST(PhysRewriter, PhysicalRewriterBasic) { } ASSERT_EQ(5, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | p2\n" @@ -95,24 +95,19 @@ TEST(PhysRewriter, PhysicalRewriterBasic) { "| PathGet [a]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p2]\n" - "| EvalPath []\n" - "| | Variable [p1]\n" - "| PathIdentity []\n" + "Evaluation [{p2}]\n" + "| EvalPath []\n" + "| | Variable [p1]\n" + "| PathIdentity []\n" "Filter []\n" "| EvalFilter []\n" "| | Variable [p1]\n" "| PathIdentity []\n" - "PhysicalScan [{'<root>': p1}, test]\n" - " BindBlock:\n" - " [p1]\n" - " Source []\n", + "PhysicalScan [{'<root>': p1}, test]\n", optimized); // Plan output with properties. - ASSERT_EXPLAIN_PROPS_V2( + ASSERT_EXPLAIN_PROPS_V2_AUTO( "Properties [cost: 0.438321, localCost: 0, adjustedCE: 10]\n" "| | Logical:\n" "| | cardinalityEstimate: \n" @@ -187,12 +182,10 @@ TEST(PhysRewriter, PhysicalRewriterBasic) { "| type: Centralized, disableExchanges\n" "| indexingRequirement: \n" "| Complete, dedupRID\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p2]\n" - "| EvalPath []\n" - "| | Variable [p1]\n" - "| PathIdentity []\n" + "Evaluation [{p2}]\n" + "| EvalPath []\n" + "| | Variable [p1]\n" + "| PathIdentity []\n" "Properties [cost: 0.428487, localCost: 0, adjustedCE: 100]\n" "| | Logical:\n" "| | cardinalityEstimate: \n" @@ -237,10 +230,7 @@ TEST(PhysRewriter, PhysicalRewriterBasic) { "| type: Centralized, disableExchanges\n" "| indexingRequirement: \n" "| Complete, dedupRID\n" - "PhysicalScan [{'<root>': p1}, test]\n" - " BindBlock:\n" - " [p1]\n" - " Source []\n", + "PhysicalScan [{'<root>': p1}, test]\n", phaseManager); } @@ -284,7 +274,7 @@ TEST(PhysRewriter, GroupBy) { phaseManager.optimize(optimized); ASSERT_EQ(7, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | c\n" @@ -305,22 +295,15 @@ TEST(PhysRewriter, GroupBy) { "| aggregations: \n" "| [c]\n" "| Variable [b]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [b]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [a]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "PhysicalScan [{'<root>': ptest}, test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + "Evaluation [{b}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Evaluation [{a}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "PhysicalScan [{'<root>': ptest}, test]\n", optimized); } @@ -367,7 +350,7 @@ TEST(PhysRewriter, GroupBy1) { } // Projection "pb1" is unused and we do not generate an aggregation expression for it. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pb\n" @@ -379,12 +362,9 @@ TEST(PhysRewriter, GroupBy1) { "| aggregations: \n" "| [pb]\n" "| Variable [pa]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pa]\n" - "| Const [null]\n" - "PhysicalScan [{}, test]\n" - " BindBlock:\n", + "Evaluation [{pa}]\n" + "| Const [null]\n" + "PhysicalScan [{}, test]\n", optimized); } @@ -428,7 +408,7 @@ TEST(PhysRewriter, Unwind) { phaseManager.optimize(optimized); ASSERT_EQ(7, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | a\n" @@ -445,27 +425,15 @@ TEST(PhysRewriter, Unwind) { "| | Variable [a]\n" "| PathIdentity []\n" "Unwind []\n" - "| BindBlock:\n" - "| [a]\n" - "| Source []\n" - "| [a_pid]\n" - "| Source []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [b]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [a]\n" - "| EvalPath []\n" - "| | Variable [ptest]\n" - "| PathIdentity []\n" - "PhysicalScan [{'<root>': ptest}, test]\n" - " BindBlock:\n" - " [ptest]\n" - " Source []\n", + "Evaluation [{b}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "Evaluation [{a}]\n" + "| EvalPath []\n" + "| | Variable [ptest]\n" + "| PathIdentity []\n" + "PhysicalScan [{'<root>': ptest}, test]\n", optimized); } @@ -508,7 +476,7 @@ TEST(PhysRewriter, DuplicateFilter) { ASSERT_EQ(2, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Only one copy of the filter. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -520,12 +488,7 @@ TEST(PhysRewriter, DuplicateFilter) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [0]\n" - "PhysicalScan [{'<root>': root, 'a': evalTemp_2}, c1]\n" - " BindBlock:\n" - " [evalTemp_2]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'a': evalTemp_2}, c1]\n", optimized); } @@ -570,7 +533,7 @@ TEST(PhysRewriter, FilterCollation) { ASSERT_BETWEEN(9, 11, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Limit-skip is attached to the collation node by virtue of physical props. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pb\n" @@ -587,12 +550,7 @@ TEST(PhysRewriter, FilterCollation) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "PhysicalScan [{'a': evalTemp_1, 'b': pb}, c1]\n" - " BindBlock:\n" - " [evalTemp_1]\n" - " Source []\n" - " [pb]\n" - " Source []\n", + "PhysicalScan [{'a': evalTemp_1, 'b': pb}, c1]\n", optimized); } @@ -626,7 +584,7 @@ TEST(PhysRewriter, EvalCollation) { phaseManager.optimize(optimized); ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -637,10 +595,7 @@ TEST(PhysRewriter, EvalCollation) { "| | pa: Ascending\n" "| RefBlock: \n" "| Variable [pa]\n" - "PhysicalScan [{'a': pa}, c1]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n", + "PhysicalScan [{'a': pa}, c1]\n", optimized); } @@ -682,7 +637,7 @@ TEST(PhysRewriter, FilterEvalCollation) { phaseManager.optimize(optimized); ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -699,12 +654,7 @@ TEST(PhysRewriter, FilterEvalCollation) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [10]\n" - "PhysicalScan [{'<root>': root, 'a': pa}, c1]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'a': pa}, c1]\n", optimized); } @@ -741,30 +691,22 @@ TEST(PhysRewriter, FilterIndexing) { ABT optimized = rootNode; phaseManager.optimize(optimized); - ASSERT_EXPLAIN_V2_AUTO( // NOLINT (test auto-update) + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" "| RefBlock: \n" "| Variable [root]\n" "RIDIntersect [root]\n" - "| Scan [c1]\n" - "| BindBlock:\n" - "| [root]\n" - "| Source []\n" + "| Scan [c1, {root}]\n" "Sargable [Index]\n" - "| | | | requirementsMap: \n" - "| | | | refProjection: root, path: 'PathGet [a] PathTraverse [1] " - "PathIdentity []', intervals: {{{=Const [1]}}}\n" - "| | | candidateIndexes: \n" - "| | | candidateId: 1, index1, {}, {SimpleEquality}, {{{=Const [1]}}}\n" - "| | BindBlock:\n" - "| RefBlock: \n" - "| Variable [root]\n" - "Scan [c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "| | | requirementsMap: \n" + "| | | refProjection: root, path: 'PathGet [a] PathTraverse [1] PathIdentity " + "[]" + "', intervals: {{{=Const [1]}}}\n" + "| | candidateIndexes: \n" + "| | candidateId: 1, index1, {}, {SimpleEquality}, {{{=Const [1]}}}\n" + "Scan [c1, {root}]\n", optimized); } @@ -785,7 +727,7 @@ TEST(PhysRewriter, FilterIndexing) { ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Test sargable filter is satisfied with an index scan. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -798,16 +740,11 @@ TEST(PhysRewriter, FilterIndexing) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[1]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "[1" + "]}]\n", optimized); } @@ -827,7 +764,7 @@ TEST(PhysRewriter, FilterIndexing) { ASSERT_EQ(2, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Test we can optimize sargable filter nodes even without an index. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -839,12 +776,7 @@ TEST(PhysRewriter, FilterIndexing) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1]\n" - " BindBlock:\n" - " [evalTemp_0]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1]\n", optimized); } } @@ -892,7 +824,7 @@ TEST(PhysRewriter, FilterIndexing1) { phaseManager.optimize(optimized); ASSERT_EQ(7, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | p1\n" @@ -905,21 +837,16 @@ TEST(PhysRewriter, FilterIndexing1) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [p1]\n" - "| EvalPath []\n" - "| | Variable [root]\n" - "| PathGet [b]\n" - "| PathLambda []\n" - "| LambdaAbstraction [t]\n" - "| BinaryOp [Add]\n" - "| | Const [1]\n" - "| Variable [t]\n" - "PhysicalScan [{'<root>': root}, c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "Evaluation [{p1}]\n" + "| EvalPath []\n" + "| | Variable [root]\n" + "| PathGet [b]\n" + "| PathLambda []\n" + "| LambdaAbstraction [t]\n" + "| BinaryOp [Add]\n" + "| | Const [1]\n" + "| Variable [t]\n" + "PhysicalScan [{'<root>': root}, c1]\n", optimized); } @@ -963,7 +890,7 @@ TEST(PhysRewriter, FilterIndexing2) { phaseManager.optimize(optimized); ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -976,16 +903,10 @@ TEST(PhysRewriter, FilterIndexing2) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[1]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [1" + "]}]\n", optimized); } @@ -1044,7 +965,7 @@ TEST(PhysRewriter, FilterIndexing2NonSarg) { ASSERT_BETWEEN(10, 15, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Demonstrate non-sargable evaluation and filter are moved under the NLJ+seek, - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -1057,9 +978,6 @@ TEST(PhysRewriter, FilterIndexing2NonSarg) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "Filter []\n" @@ -1070,20 +988,13 @@ TEST(PhysRewriter, FilterIndexing2NonSarg) { "| LambdaAbstraction [var]\n" "| FunctionCall [someFunction]\n" "| Variable [var]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pb]\n" - "| EvalPath []\n" - "| | Variable [pa]\n" - "| PathGet [b]\n" - "| PathIdentity []\n" + "Evaluation [{pb}]\n" + "| EvalPath []\n" + "| | Variable [pa]\n" + "| PathGet [b]\n" + "| PathIdentity []\n" "IndexScan [{'<indexKey> 0': pa, '<rid>': rid_0}, scanDefName: c1, indexDefName: index1, " - "interval: {=Const [1]}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n", + "interval: {=Const [1]}]\n", optimized); LogicalRewriteType logicalRules[] = {LogicalRewriteType::Root, @@ -1167,17 +1078,14 @@ TEST(PhysRewriter, FilterIndexing3) { ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); // We dont need a Seek if we dont have multi-key paths. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" "| RefBlock: \n" "| Variable [pa]\n" - "IndexScan [{'<indexKey> 0': pa}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[1], <fully open>}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n", + "IndexScan [{'<indexKey> 0': pa}, scanDefName: c1, indexDefName: index1, interval: {=Cons" + "t [1], <fully open>}]\n", optimized); } @@ -1222,7 +1130,7 @@ TEST(PhysRewriter, FilterIndexing3MultiKey) { ASSERT_BETWEEN(5, 8, phaseManager.getMemo().getStats()._physPlanExplorationCount); // We need a Seek to obtain value for "a". - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -1235,19 +1143,13 @@ TEST(PhysRewriter, FilterIndexing3MultiKey) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'a': pa}, c1]\n" - "| | BindBlock:\n" - "| | [pa]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "Unique []\n" "| projections: \n" "| rid_0\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[1], <fully open>}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [1" + "], <fully open>}]\n", optimized); } @@ -1334,7 +1236,7 @@ TEST(PhysRewriter, FilterIndexing4) { ASSERT_EQ(el.Double(), pathAndCE.second); } - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -1355,18 +1257,9 @@ TEST(PhysRewriter, FilterIndexing4) { "| | Variable [evalTemp_12]\n" "| PathCompare [Gt]\n" "| Const [1]\n" - "IndexScan [{'<indexKey> 0': pa, '<indexKey> 1': evalTemp_12, '<indexKey> 2': evalTemp_13, " - "'<indexKey> 3': evalTemp_14}, scanDefName: c1, indexDefName: index1, interval: {>Const " - "[1], >Const [maxKey], >Const [maxKey], >Const [maxKey]}]\n" - " BindBlock:\n" - " [evalTemp_12]\n" - " Source []\n" - " [evalTemp_13]\n" - " Source []\n" - " [evalTemp_14]\n" - " Source []\n" - " [pa]\n" - " Source []\n", + "IndexScan [{'<indexKey> 0': pa, '<indexKey> 1': evalTemp_12, '<indexKey> 2': evalTemp_13" + ", '<indexKey> 3': evalTemp_14}, scanDefName: c1, indexDefName: index1, interval: {>Const" + " [1], >Const [maxKey], >Const [maxKey], >Const [maxKey]}]\n", optimized); } @@ -1426,7 +1319,7 @@ TEST(PhysRewriter, FilterIndexing5) { ASSERT_BETWEEN(10, 25, phaseManager.getMemo().getStats()._physPlanExplorationCount); // We can cover both fields with the index, and need separate sort on "b". - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -1444,19 +1337,12 @@ TEST(PhysRewriter, FilterIndexing5) { "| | Variable [pb]\n" "| PathCompare [Gt]\n" "| Const [0]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pb]\n" - "| EvalPath []\n" - "| | Variable [evalTemp_0]\n" - "| PathIdentity []\n" - "IndexScan [{'<indexKey> 0': pa, '<indexKey> 1': evalTemp_0}, scanDefName: c1, " - "indexDefName: index1, interval: {>Const [0], >Const [maxKey]}]\n" - " BindBlock:\n" - " [evalTemp_0]\n" - " Source []\n" - " [pa]\n" - " Source []\n", + "Evaluation [{pb}]\n" + "| EvalPath []\n" + "| | Variable [evalTemp_0]\n" + "| PathIdentity []\n" + "IndexScan [{'<indexKey> 0': pa, '<indexKey> 1': evalTemp_0}, scanDefName: c1, indexDefNa" + "me: index1, interval: {>Const [0], >Const [maxKey]}]\n", optimized); } @@ -1516,7 +1402,7 @@ TEST(PhysRewriter, FilterIndexing6) { ASSERT_BETWEEN(5, 15, phaseManager.getMemo().getStats()._physPlanExplorationCount); // We can cover both fields with the index, and do not need a separate sort on "b". - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -1524,13 +1410,8 @@ TEST(PhysRewriter, FilterIndexing6) { "| RefBlock: \n" "| Variable [pa]\n" "| Variable [pb]\n" - "IndexScan [{'<indexKey> 0': pa, '<indexKey> 1': pb}, scanDefName: c1, indexDefName: " - "index1, interval: {=Const [0], >Const [0]}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n" - " [pb]\n" - " Source []\n", + "IndexScan [{'<indexKey> 0': pa, '<indexKey> 1': pb}, scanDefName: c1, indexDefName: inde" + "x1, interval: {=Const [0], >Const [0]}]\n", optimized); } @@ -1675,7 +1556,7 @@ TEST(PhysRewriter, FilterIndexingVariable) { // Observe unioning of two index scans with complex expressions for bounds. This encodes: // (max(param_0, param_1), Const [maxKey]] U [param_0 > param_1 ? MaxKey : param_1, max(param_0, // param_1)] - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -1688,9 +1569,6 @@ TEST(PhysRewriter, FilterIndexingVariable) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "GroupBy []\n" @@ -1698,30 +1576,20 @@ TEST(PhysRewriter, FilterIndexingVariable) { "| | RefBlock: \n" "| | Variable [rid_0]\n" "| aggregations: \n" - "Union []\n" - "| | BindBlock:\n" - "| | [rid_0]\n" - "| | Source []\n" - "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {[If [] " - "BinaryOp [And] BinaryOp [And] BinaryOp [Or] BinaryOp [Or] BinaryOp [And] BinaryOp [Lt] " - "FunctionCall [getQueryParam] Const [1] FunctionCall [getQueryParam] Const [0] BinaryOp " - "[Lt] FunctionCall [getQueryParam] Const [0] Const [maxKey] Const [true] BinaryOp [Or] " - "BinaryOp [And] BinaryOp [Lt] FunctionCall [getQueryParam] Const [0] FunctionCall " - "[getQueryParam] Const [1] Const [true] BinaryOp [And] BinaryOp [Lt] FunctionCall " - "[getQueryParam] Const [0] Const [maxKey] Const [true] BinaryOp [And] BinaryOp [Lt] " - "FunctionCall [getQueryParam] Const [0] Const [maxKey] Const [true] BinaryOp [Gt] " - "FunctionCall [getQueryParam] Const [1] FunctionCall [getQueryParam] Const [0] " - "FunctionCall [getQueryParam] Const [1] Const [maxKey], FunctionCall [getQueryParam] Const " - "[1]]}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {>If [] " - "BinaryOp [Gte] FunctionCall [getQueryParam] Const [0] FunctionCall [getQueryParam] Const " - "[1] FunctionCall [getQueryParam] Const [0] FunctionCall [getQueryParam] Const [1]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "Union [{rid_0}]\n" + "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {[If [" + "] BinaryOp [And] BinaryOp [And] BinaryOp [Or] BinaryOp [Or] BinaryOp [And] BinaryOp [Lt]" + " FunctionCall [getQueryParam] Const [1] FunctionCall [getQueryParam] Const [0] BinaryOp " + "[Lt] FunctionCall [getQueryParam] Const [0] Const [maxKey] Const [true] BinaryOp [Or] Bi" + "naryOp [And] BinaryOp [Lt] FunctionCall [getQueryParam] Const [0] FunctionCall [getQuery" + "Param] Const [1] Const [true] BinaryOp [And] BinaryOp [Lt] FunctionCall [getQueryParam] " + "Const [0] Const [maxKey] Const [true] BinaryOp [And] BinaryOp [Lt] FunctionCall [getQuer" + "yParam] Const [0] Const [maxKey] Const [true] BinaryOp [Gt] FunctionCall [getQueryParam]" + " Const [1] FunctionCall [getQueryParam] Const [0] FunctionCall [getQueryParam] Const [1]" + " Const [maxKey], FunctionCall [getQueryParam] Const [1]]}]\n" + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {>If [] Bi" + "naryOp [Gte] FunctionCall [getQueryParam] Const [0] FunctionCall [getQueryParam] Const [" + "1] FunctionCall [getQueryParam] Const [0] FunctionCall [getQueryParam] Const [1]}]\n", optimized); } @@ -1769,7 +1637,7 @@ TEST(PhysRewriter, FilterIndexingMaxKey) { phaseManager.optimize(optimized); // Observe redundant predicate a <= MaxKey is removed. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -1790,14 +1658,7 @@ TEST(PhysRewriter, FilterIndexingMaxKey) { "| PathTraverse [1]\n" "| PathCompare [Gt]\n" "| Const [1]\n" - "PhysicalScan [{'<root>': root, 'a': evalTemp_2, 'b': evalTemp_3}, c1]\n" - " BindBlock:\n" - " [evalTemp_2]\n" - " Source []\n" - " [evalTemp_3]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'a': evalTemp_2, 'b': evalTemp_3}, c1]\n", optimized); } @@ -1859,19 +1720,13 @@ TEST(PhysRewriter, FilterIndexingRIN) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "NestedLoopJoin [joinType: Inner, {evalTemp_57, evalTemp_58, evalTemp_59, evalTemp_60}]\n" "| | Const [true]\n" - "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: " - "{=Variable [evalTemp_57], =Variable [evalTemp_58], =Variable [evalTemp_59], =Variable " - "[evalTemp_60], =Const [3]}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" + "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Vari" + "able [evalTemp_57], =Variable [evalTemp_58], =Variable [evalTemp_59], =Variable [evalTem" + "p_60], =Const [3]}]\n" "Unique []\n" "| projections: \n" "| evalTemp_57\n" @@ -1881,25 +1736,15 @@ TEST(PhysRewriter, FilterIndexingRIN) { "NestedLoopJoin [joinType: Inner, {evalTemp_57, evalTemp_58}]\n" "| | Const [true]\n" "| IndexScan [{'<indexKey> 2': evalTemp_59, '<indexKey> 3': evalTemp_60}, scanDefName: " - "c1, indexDefName: index1, interval: {=Variable [evalTemp_57], =Variable [evalTemp_58], " - ">Const [2], >Const [maxKey], >Const [maxKey]}]\n" - "| BindBlock:\n" - "| [evalTemp_59]\n" - "| Source []\n" - "| [evalTemp_60]\n" - "| Source []\n" + "c1, indexDefName: index1, interval: {=Variable [evalTemp_57], =Variable [evalTemp_58], >" + "Const [2], >Const [maxKey], >Const [maxKey]}]\n" "Unique []\n" "| projections: \n" "| evalTemp_57\n" "| evalTemp_58\n" "IndexScan [{'<indexKey> 0': evalTemp_57, '<indexKey> 1': evalTemp_58}, scanDefName: c1, " - "indexDefName: index1, interval: {>Const [1], >Const [maxKey], >Const [maxKey], >Const " - "[maxKey], >Const [maxKey]}]\n" - " BindBlock:\n" - " [evalTemp_57]\n" - " Source []\n" - " [evalTemp_58]\n" - " Source []\n", + "indexDefName: index1, interval: {>Const [1], >Const [maxKey], >Const [maxKey], >Const [m" + "axKey], >Const [maxKey]}]\n", optimized); } @@ -1961,26 +1806,17 @@ TEST(PhysRewriter, FilterIndexingRIN1) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "NestedLoopJoin [joinType: Inner, {pa}]\n" "| | Const [true]\n" - "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: " - "{=Variable [pa], >Const [2]}, reversed]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" + "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Vari" + "able [pa], >Const [2]}, reversed]\n" "Unique []\n" "| projections: \n" "| pa\n" - "IndexScan [{'<indexKey> 0': pa}, scanDefName: c1, indexDefName: index1, interval: {>Const " - "[1], >Const [maxKey]}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n", + "IndexScan [{'<indexKey> 0': pa}, scanDefName: c1, indexDefName: index1, interval: {>Cons" + "t [1], >Const [maxKey]}]\n", optimized); } @@ -2045,9 +1881,6 @@ TEST(PhysRewriter, FilterIndexingRIN2) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "NestedLoopJoin [joinType: Inner, {evalTemp_10}]\n" @@ -2057,27 +1890,15 @@ TEST(PhysRewriter, FilterIndexingRIN2) { "| | | RefBlock: \n" "| | | Variable [rid_0]\n" "| | aggregations: \n" - "| Union []\n" - "| | | BindBlock:\n" - "| | | [rid_0]\n" - "| | | Source []\n" - "| | IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: " - "{=Variable [evalTemp_10], [Const [7], Const [8]]}]\n" - "| | BindBlock:\n" - "| | [rid_0]\n" - "| | Source []\n" - "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: " - "{=Variable [evalTemp_10], [Const [5], Const [6]]}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" + "| Union [{rid_0}]\n" + "| | IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=" + "Variable [evalTemp_10], [Const [7], Const [8]]}]\n" + "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Vari" + "able [evalTemp_10], [Const [5], Const [6]]}]\n" "Unique []\n" "| projections: \n" "| evalTemp_10\n" - "Union []\n" - "| BindBlock:\n" - "| [evalTemp_10]\n" - "| Source []\n" + "Union [{evalTemp_10}]\n" "GroupBy []\n" "| | groupings: \n" "| | RefBlock: \n" @@ -2086,26 +1907,11 @@ TEST(PhysRewriter, FilterIndexingRIN2) { "| [evalTemp_10]\n" "| FunctionCall [$first]\n" "| Variable [disjunction_0]\n" - "Union []\n" - "| | BindBlock:\n" - "| | [disjunction_0]\n" - "| | Source []\n" - "| | [rid_0]\n" - "| | Source []\n" - "| IndexScan [{'<indexKey> 0': disjunction_0, '<rid>': rid_0}, scanDefName: c1, " - "indexDefName: index1, interval: {[Const [3], Const [4]], <fully open>}]\n" - "| BindBlock:\n" - "| [disjunction_0]\n" - "| Source []\n" - "| [rid_0]\n" - "| Source []\n" - "IndexScan [{'<indexKey> 0': disjunction_0, '<rid>': rid_0}, scanDefName: c1, " - "indexDefName: index1, interval: {[Const [1], Const [2]], <fully open>}]\n" - " BindBlock:\n" - " [disjunction_0]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n", + "Union [{disjunction_0, rid_0}]\n" + "| IndexScan [{'<indexKey> 0': disjunction_0, '<rid>': rid_0}, scanDefName: c1, indexDe" + "fName: index1, interval: {[Const [3], Const [4]], <fully open>}]\n" + "IndexScan [{'<indexKey> 0': disjunction_0, '<rid>': rid_0}, scanDefName: c1, indexDefNam" + "e: index1, interval: {[Const [1], Const [2]], <fully open>}]\n", optimized); } @@ -2145,35 +1951,25 @@ TEST(PhysRewriter, SargableProjectionRenames) { // Demonstrate we can combine the field access to "a" into a single entry and provide two output // projections. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" "| RefBlock: \n" "| Variable [root]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pa1]\n" - "| Variable [pa]\n" + "Evaluation [{pa1}]\n" + "| Variable [pa]\n" "Sargable [Complete]\n" - "| | | | | requirementsMap: \n" - "| | | | | refProjection: root, path: 'PathGet [a] PathIdentity []', " - "boundProjection: pa, intervals: {{{=Const [1]}}}\n" - "| | | | candidateIndexes: \n" - "| | | scanParams: \n" - "| | | {'a': pa}\n" - "| | | residualReqs: \n" - "| | | refProjection: pa, path: 'PathIdentity []', intervals: {{{=Const " - "[1]}}}, entryIndex: 0\n" - "| | BindBlock:\n" - "| | [pa]\n" - "| | Source []\n" - "| RefBlock: \n" - "| Variable [root]\n" - "Scan [c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "| | | | requirementsMap: \n" + "| | | | refProjection: root, path: 'PathGet [a] PathIdentity []', boundProje" + "ction: pa, intervals: {{{=Const [1]}}}\n" + "| | | candidateIndexes: \n" + "| | scanParams: \n" + "| | {'a': pa}\n" + "| | residualReqs: \n" + "| | refProjection: pa, path: 'PathIdentity []', intervals: {{{=Const [1]" + "}}}, entryIndex: 0\n" + "Scan [c1, {root}]\n", optimized); } @@ -2207,31 +2003,23 @@ TEST(PhysRewriter, SargableAcquireProjection) { phaseManager.optimize(optimized); // Demonstrate that we combine the field access for the filter and eval nodes. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" "| RefBlock: \n" "| Variable [root]\n" "Sargable [Complete]\n" - "| | | | | requirementsMap: \n" - "| | | | | refProjection: root, path: 'PathGet [a] PathIdentity []', " - "boundProjection: pa, intervals: {{{=Const [1]}}}\n" - "| | | | candidateIndexes: \n" - "| | | scanParams: \n" - "| | | {'a': pa}\n" - "| | | residualReqs: \n" - "| | | refProjection: pa, path: 'PathIdentity []', intervals: {{{=Const " - "[1]}}}, entryIndex: 0\n" - "| | BindBlock:\n" - "| | [pa]\n" - "| | Source []\n" - "| RefBlock: \n" - "| Variable [root]\n" - "Scan [c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "| | | | requirementsMap: \n" + "| | | | refProjection: root, path: 'PathGet [a] PathIdentity []', boundProje" + "ction: pa, intervals: {{{=Const [1]}}}\n" + "| | | candidateIndexes: \n" + "| | scanParams: \n" + "| | {'a': pa}\n" + "| | residualReqs: \n" + "| | refProjection: pa, path: 'PathIdentity []', intervals: {{{=Const [1]" + "}}}, entryIndex: 0\n" + "Scan [c1, {root}]\n", optimized); } @@ -2279,7 +2067,7 @@ TEST(PhysRewriter, FilterReorder) { // Observe filters are ordered from most selective (lowest sel) to least selective (highest // sel). - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -2315,21 +2103,8 @@ TEST(PhysRewriter, FilterReorder) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [4]\n" - "PhysicalScan [{'<root>': root, 'field_0': evalTemp_14, 'field_1': evalTemp_15, 'field_2': " - "evalTemp_16, 'field_3': evalTemp_17, 'field_4': evalTemp_18}, c1]\n" - " BindBlock:\n" - " [evalTemp_14]\n" - " Source []\n" - " [evalTemp_15]\n" - " Source []\n" - " [evalTemp_16]\n" - " Source []\n" - " [evalTemp_17]\n" - " Source []\n" - " [evalTemp_18]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'field_0': evalTemp_14, 'field_1': evalTemp_15, 'field_2'" + ": evalTemp_16, 'field_3': evalTemp_17, 'field_4': evalTemp_18}, c1]\n", optimized); } @@ -2376,7 +2151,7 @@ TEST(PhysRewriter, CoveredScan) { // Since we do not optimize with fast null handling, we need to split the predicate between the // index scan and fetch in order to handle null. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -2389,16 +2164,10 @@ TEST(PhysRewriter, CoveredScan) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'a': pa}, c1]\n" - "| | BindBlock:\n" - "| | [pa]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {<Const " - "[1]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {<Const [1" + "]}]\n", optimized); } @@ -2443,17 +2212,15 @@ TEST(PhysRewriter, EvalIndexing) { ASSERT_BETWEEN(5, 10, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Should not need a collation node. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" "| RefBlock: \n" "| Variable [pa]\n" "IndexScan [{'<indexKey> 0': pa}, scanDefName: c1, indexDefName: index1, interval: " - "{>Const [1]}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n", + "{>Cons" + "t [1]}]\n", optimized); } @@ -2477,7 +2244,7 @@ TEST(PhysRewriter, EvalIndexing) { ASSERT_EQ(10, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Index does not have the right collation and now we need a collation node. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -2488,11 +2255,9 @@ TEST(PhysRewriter, EvalIndexing) { "| | pa: Ascending\n" "| RefBlock: \n" "| Variable [pa]\n" - "IndexScan [{'<indexKey> 0': pa}, scanDefName: c1, indexDefName: index1, " - "interval: {>Const [1]}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n", + "IndexScan [{'<indexKey> 0': pa}, scanDefName: c1, indexDefName: index1, interval: " + "{>Cons" + "t [1]}]\n", optimized); } } @@ -2536,7 +2301,7 @@ TEST(PhysRewriter, EvalIndexing1) { phaseManager.optimize(optimized); ASSERT_EQ(8, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -2549,16 +2314,10 @@ TEST(PhysRewriter, EvalIndexing1) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[1]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [1" + "]}]\n", optimized); } @@ -2611,29 +2370,22 @@ TEST(PhysRewriter, EvalIndexing2) { ASSERT_BETWEEN(8, 18, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Verify collation is subsumed into the index scan. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa2\n" "| RefBlock: \n" "| Variable [pa2]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pa3]\n" - "| Variable [pa1]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pa2]\n" - "| EvalPath []\n" - "| | Const [0]\n" - "| PathField [a]\n" - "| PathConstant []\n" - "| Variable [pa1]\n" - "IndexScan [{'<indexKey> 0': pa1}, scanDefName: c1, indexDefName: index1, interval: " - "{<fully open>}]\n" - " BindBlock:\n" - " [pa1]\n" - " Source []\n", + "Evaluation [{pa3}]\n" + "| Variable [pa1]\n" + "Evaluation [{pa2}]\n" + "| EvalPath []\n" + "| | Const [0]\n" + "| PathField [a]\n" + "| PathConstant []\n" + "| Variable [pa1]\n" + "IndexScan [{'<indexKey> 0': pa1}, scanDefName: c1, indexDefName: index1, interval: {<ful" + "ly open>}]\n", optimized); } @@ -2707,7 +2459,7 @@ TEST(PhysRewriter, MultiKeyIndex) { // GroupBy+Union cannot propagate collation requirement, and we need a separate // CollationNode. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -2727,9 +2479,6 @@ TEST(PhysRewriter, MultiKeyIndex) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "Filter []\n" @@ -2752,54 +2501,23 @@ TEST(PhysRewriter, MultiKeyIndex) { "| [sides_0]\n" "| FunctionCall [$addToSet]\n" "| Variable [sideId_0]\n" - "Union []\n" - "| | BindBlock:\n" - "| | [rid_0]\n" - "| | Source []\n" - "| | [sideId_0]\n" - "| | Source []\n" - "| | [unionTemp_0]\n" - "| | Source []\n" - "| | [unionTemp_1]\n" - "| | Source []\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [unionTemp_1]\n" - "| | Variable [pb]\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [unionTemp_0]\n" - "| | Const [Nothing]\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [sideId_0]\n" - "| | Const [1]\n" + "Union [{rid_0, sideId_0, unionTemp_0, unionTemp_1}]\n" + "| Evaluation [{unionTemp_1}]\n" + "| | Variable [pb]\n" + "| Evaluation [{unionTemp_0}]\n" + "| | Const [Nothing]\n" + "| Evaluation [{sideId_0}]\n" + "| | Const [1]\n" "| IndexScan [{'<indexKey> 0': pb, '<rid>': rid_0}, scanDefName: c1, indexDefName: " "index2, interval: {[Const [maxKey], Const [2])}]\n" - "| BindBlock:\n" - "| [pb]\n" - "| Source []\n" - "| [rid_0]\n" - "| Source []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [unionTemp_1]\n" - "| Const [Nothing]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [unionTemp_0]\n" - "| Variable [pa]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [sideId_0]\n" - "| Const [0]\n" + "Evaluation [{unionTemp_1}]\n" + "| Const [Nothing]\n" + "Evaluation [{unionTemp_0}]\n" + "| Variable [pa]\n" + "Evaluation [{sideId_0}]\n" + "| Const [0]\n" "IndexScan [{'<indexKey> 0': pa, '<rid>': rid_0}, scanDefName: c1, indexDefName: " - "index1, interval: {=Const [1]}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n", + "index1, interval: {=Const [1]}]\n", optimized); } @@ -2812,7 +2530,7 @@ TEST(PhysRewriter, MultiKeyIndex) { ASSERT_BETWEEN(15, 25, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Index2 will be used in reverse direction. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -2825,32 +2543,18 @@ TEST(PhysRewriter, MultiKeyIndex) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "HashJoin [joinType: Inner]\n" "| | Condition\n" "| | rid_0 = rid_2\n" - "| Union []\n" - "| | BindBlock:\n" - "| | [rid_2]\n" - "| | Source []\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [rid_2]\n" - "| | Variable [rid_0]\n" + "| Union [{rid_2}]\n" + "| Evaluation [{rid_2}]\n" + "| | Variable [rid_0]\n" "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index2, interval: " "{[Const [maxKey], Const [2])}, reversed]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[1]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "[1]}]\n", optimized); } } @@ -3260,7 +2964,7 @@ TEST(PhysRewriter, CompoundIndex5) { // Demonstrate that we create four compound {a, b} index bounds: [=0, =2], [=0, =3], [=1, =2] // and [=1, =3]. // TODO: SERVER-70298: we should be seeing merge joins instead of union+groupby. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -3273,9 +2977,6 @@ TEST(PhysRewriter, CompoundIndex5) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "GroupBy []\n" @@ -3283,30 +2984,15 @@ TEST(PhysRewriter, CompoundIndex5) { "| | RefBlock: \n" "| | Variable [rid_0]\n" "| aggregations: \n" - "Union []\n" - "| | | | BindBlock:\n" - "| | | | [rid_0]\n" - "| | | | Source []\n" - "| | | IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: " - "{=Const [1], =Const [3]}]\n" - "| | | BindBlock:\n" - "| | | [rid_0]\n" - "| | | Source []\n" - "| | IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: " - "{=Const [0], =Const [3]}]\n" - "| | BindBlock:\n" - "| | [rid_0]\n" - "| | Source []\n" - "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[1], =Const [2]}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[0], =Const [2]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "Union [{rid_0}]\n" + "| | | IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval" + ": {=Const [1], =Const [3]}]\n" + "| | IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=" + "Const [0], =Const [3]}]\n" + "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Cons" + "t [1], =Const [2]}]\n" + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [0" + "], =Const [2]}]\n", optimized); } @@ -3437,7 +3123,7 @@ TEST(PhysRewriter, IndexBoundsIntersect1) { // Demonstrate we can intersect the intervals since we have non-multikey paths, and the // collation requirement is satisfied via the index scan. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -3450,16 +3136,10 @@ TEST(PhysRewriter, IndexBoundsIntersect1) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {(Const " - "[70], Const [90])}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {(Const [7" + "0], Const [90])}]\n", optimized); } @@ -3510,7 +3190,7 @@ TEST(PhysRewriter, IndexBoundsIntersect2) { // Demonstrate we can intersect the bounds here because composition does not contain // traverse. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -3523,19 +3203,13 @@ TEST(PhysRewriter, IndexBoundsIntersect2) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "Unique []\n" "| projections: \n" "| rid_0\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {(Const " - "[70], Const [90])}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {(Const [7" + "0], Const [90])}]\n", optimized); } @@ -3591,7 +3265,7 @@ TEST(PhysRewriter, IndexBoundsIntersect3) { ASSERT_BETWEEN(10, 15, phaseManager.getMemo().getStats()._physPlanExplorationCount); // We do not intersect the bounds, because the outer composition is over the different fields. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -3611,10 +3285,7 @@ TEST(PhysRewriter, IndexBoundsIntersect3) { "| PathTraverse [1]\n" "| PathCompare [Gt]\n" "| Const [70]\n" - "PhysicalScan [{'<root>': root}, c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root}, c1]\n", optimized); } @@ -3667,7 +3338,7 @@ TEST(PhysRewriter, IndexResidualReq) { ASSERT_BETWEEN(5, 15, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Make sure we can use the index to cover "b" while testing "b.c" with a separate filter. - ASSERT_EXPLAIN_PROPS_V2( + ASSERT_EXPLAIN_PROPS_V2_AUTO( "Properties [cost: 0.176361, localCost: 0, adjustedCE: 189.571]\n" "| | Logical:\n" "| | cardinalityEstimate: \n" @@ -3725,13 +3396,8 @@ TEST(PhysRewriter, IndexResidualReq) { "| PathGet [c]\n" "| PathCompare [Gt]\n" "| Const [0]\n" - "IndexScan [{'<indexKey> 0': pa, '<indexKey> 1': evalTemp_2}, scanDefName: c1, " - "indexDefName: index1, interval: {>Const [0], >Const [maxKey]}]\n" - " BindBlock:\n" - " [evalTemp_2]\n" - " Source []\n" - " [pa]\n" - " Source []\n", + "IndexScan [{'<indexKey> 0': pa, '<indexKey> 1': evalTemp_2}, scanDefName: c1, indexDefNa" + "me: index1, interval: {>Const [0], >Const [maxKey]}]\n", phaseManager); } @@ -3799,7 +3465,7 @@ TEST(PhysRewriter, IndexResidualReq1) { ASSERT_BETWEEN(65, 90, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Prefer index1 over index2 and index3 in order to cover all fields. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -3812,16 +3478,10 @@ TEST(PhysRewriter, IndexResidualReq1) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[0], =Const [0], =Const [0], <fully open>}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [0" + "], =Const [0], =Const [0], <fully open>}]\n", optimized); } @@ -3870,7 +3530,7 @@ TEST(PhysRewriter, IndexResidualReq2) { ASSERT_BETWEEN(7, 10, phaseManager.getMemo().getStats()._physPlanExplorationCount); // We can cover "b" with the index and filter before we Seek. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -3883,9 +3543,6 @@ TEST(PhysRewriter, IndexResidualReq2) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "Unique []\n" @@ -3896,13 +3553,8 @@ TEST(PhysRewriter, IndexResidualReq2) { "| | Variable [evalTemp_10]\n" "| PathCompare [Eq]\n" "| Const [0]\n" - "IndexScan [{'<indexKey> 2': evalTemp_10, '<rid>': rid_0}, scanDefName: c1, indexDefName: " - "index1, interval: {=Const [0], <fully open>, <fully open>}]\n" - " BindBlock:\n" - " [evalTemp_10]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<indexKey> 2': evalTemp_10, '<rid>': rid_0}, scanDefName: c1, indexDefName:" + " index1, interval: {=Const [0], <fully open>, <fully open>}]\n", optimized); } @@ -3943,7 +3595,7 @@ TEST(PhysRewriter, ElemMatchIndex) { phaseManager.optimize(optimized); ASSERT_EQ(6, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -3960,21 +3612,13 @@ TEST(PhysRewriter, ElemMatchIndex) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root, 'a': evalTemp_4}, c1]\n" - "| | BindBlock:\n" - "| | [evalTemp_4]\n" - "| | Source []\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "Unique []\n" "| projections: \n" "| rid_0\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {(Const " - "[70], Const [90])}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {(Const [7" + "0], Const [90])}]\n", optimized); } @@ -4029,7 +3673,7 @@ TEST(PhysRewriter, ElemMatchIndex1) { // Demonstrate we can cover both the filter and the extracted elemMatch predicate with the // index. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -4046,21 +3690,13 @@ TEST(PhysRewriter, ElemMatchIndex1) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root, 'a': evalTemp_17}, c1]\n" - "| | BindBlock:\n" - "| | [evalTemp_17]\n" - "| | Source []\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "Unique []\n" "| projections: \n" "| rid_0\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[1], (Const [70], Const [90])}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [1" + "], (Const [70], Const [90])}]\n", optimized); } @@ -4105,16 +3741,14 @@ TEST(PhysRewriter, ElemMatchIndexNoArrays) { ASSERT_EQ(2, phaseManager.getMemo().getStats()._physPlanExplorationCount); // If we do not have arrays (index is not multikey) we simplify to unsatisfiable query. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" "| RefBlock: \n" "| Variable [root]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [root]\n" - "| Const [Nothing]\n" + "Evaluation [{root}]\n" + "| Const [Nothing]\n" "LimitSkip []\n" "| limitSkip:\n" "| limit: 0\n" @@ -4209,11 +3843,6 @@ TEST(PhysRewriter, ObjectElemMatchResidual) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root, 'a': evalTemp_3}, c1]\n" - "| | BindBlock:\n" - "| | [evalTemp_3]\n" - "| | Source []\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "Unique []\n" @@ -4224,12 +3853,7 @@ TEST(PhysRewriter, ObjectElemMatchResidual) { "| | Variable [evalTemp_8]\n" "| PathGet [c] PathTraverse [1] PathCompare [Eq] Const [1]\n" "IndexScan [{'<indexKey> 1': evalTemp_8, '<rid>': rid_0}, scanDefName: c1, indexDefName: " - "index1, interval: {<fully open>, <fully open>}]\n" - " BindBlock:\n" - " [evalTemp_8]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n", + "index1, interval: {<fully open>, <fully open>}]\n", optimized); } @@ -4283,7 +3907,7 @@ TEST(PhysRewriter, ObjectElemMatchBounds) { ASSERT_BETWEEN(15, 20, phaseManager.getMemo().getStats()._physPlanExplorationCount); // We should pick the index, and generate bounds for the 'b' predicate. - ASSERT_EXPLAIN_V2Compact( + ASSERT_EXPLAIN_V2Compact_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -4310,18 +3934,10 @@ TEST(PhysRewriter, ObjectElemMatchBounds) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root, 'a': evalTemp_2}, c1]\n" - "| | BindBlock:\n" - "| | [evalTemp_2]\n" - "| | Source []\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[4]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [4" + "]}]\n", optimized); } @@ -4372,7 +3988,7 @@ TEST(PhysRewriter, NestedElemMatch) { // arrays of arrays, and multikey indexes only unwind one level of arrays. We can generate // PathArr bounds, but that only tells us which documents have arrays-of-arrays; then we can run // a residual predicate to check that the inner array contains '2'. - ASSERT_EXPLAIN_V2Compact( + ASSERT_EXPLAIN_V2Compact_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -4395,14 +4011,8 @@ TEST(PhysRewriter, NestedElemMatch) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root, 'a': evalTemp_2}, coll1]\n" - "| | BindBlock:\n" - "| | [evalTemp_2]\n" - "| | Source []\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - // Filter GroupBy Union: this implements RIDIntersect. "Filter []\n" "| EvalFilter []\n" "| | FunctionCall [getArraySize] Variable [sides_0]\n" @@ -4414,40 +4024,19 @@ TEST(PhysRewriter, NestedElemMatch) { "| aggregations: \n" "| [sides_0]\n" "| FunctionCall [$addToSet] Variable [sideId_0]\n" - "Union []\n" - "| | BindBlock:\n" - "| | [rid_0]\n" - "| | Source []\n" - "| | [sideId_0]\n" - "| | Source []\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [sideId_0]\n" - "| | Const [1]\n" - // Scan only the array portion of the index. - // Since each index entry is an array element, this represents docs with arrays-of-arrays. - "| IndexScan [{'<rid>': rid_0}, scanDefName: coll1, indexDefName: index1, interval: " - "{[Const [[]], Const [BinData(0, )])}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [sideId_0]\n" - "| Const [0]\n" - // Keep index entries that equal-or-contain 2. + "Union [{rid_0, sideId_0}]\n" + "| Evaluation [{sideId_0}]\n" + "| | Const [1]\n" + "| IndexScan [{'<rid>': rid_0}, scanDefName: coll1, indexDefName: index1, interval: {[C" + "onst [[]], Const [BinData(0, )])}]\n" + "Evaluation [{sideId_0}]\n" + "| Const [0]\n" "Filter []\n" "| EvalFilter []\n" "| | Variable [evalTemp_3]\n" "| PathTraverse [1] PathCompare [Eq] Const [2]\n" - // Scan the whole index. - "IndexScan [{'<indexKey> 0': evalTemp_3, '<rid>': rid_0}, scanDefName: coll1, " - "indexDefName: index1, interval: {<fully open>}]\n" - " BindBlock:\n" - " [evalTemp_3]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<indexKey> 0': evalTemp_3, '<rid>': rid_0}, scanDefName: coll1, indexDefNam" + "e: index1, interval: {<fully open>}]\n", optimized); } @@ -4489,7 +4078,7 @@ TEST(PhysRewriter, PathObj) { ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); // We should get index bounds for the PathObj. - ASSERT_EXPLAIN_V2Compact( + ASSERT_EXPLAIN_V2Compact_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -4502,19 +4091,13 @@ TEST(PhysRewriter, PathObj) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "Unique []\n" "| projections: \n" "| rid_0\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {[Const " - "[{}], Const [[]]), <Const [minKey]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {[Const [{" + "}], Const [[]]), <Const [minKey]}]\n", optimized); } @@ -4574,7 +4157,7 @@ TEST(PhysRewriter, ArrayConstantIndex) { // Demonstrate we get index bounds to handle the array constant, while we also retain the // original filter. We have index bound with the array itself unioned with bound using the first // array element. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -4597,9 +4180,6 @@ TEST(PhysRewriter, ArrayConstantIndex) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "GroupBy []\n" @@ -4607,20 +4187,11 @@ TEST(PhysRewriter, ArrayConstantIndex) { "| | RefBlock: \n" "| | Variable [rid_0]\n" "| aggregations: \n" - "Union []\n" - "| | BindBlock:\n" - "| | [rid_0]\n" - "| | Source []\n" - "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[0], =Const [[1, 2, 3]]}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[0], =Const [1]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "Union [{rid_0}]\n" + "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Cons" + "t [0], =Const [[1, 2, 3]]}]\n" + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [0" + "], =Const [1]}]\n", optimized); } @@ -4674,7 +4245,7 @@ TEST(PhysRewriter, ArrayConstantNoIndex) { // Without an index, we retain the original array bounds predicate, and do not duplicate the // predicates in the sargable node (they are perf only) - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -4696,12 +4267,7 @@ TEST(PhysRewriter, ArrayConstantNoIndex) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [0]\n" - "PhysicalScan [{'<root>': root, 'b': evalTemp_1}, c1]\n" - " BindBlock:\n" - " [evalTemp_1]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'b': evalTemp_1}, c1]\n", optimized); } @@ -4737,7 +4303,7 @@ TEST(PhysRewriter, ParallelScan) { phaseManager.optimize(optimized); ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -4753,12 +4319,7 @@ TEST(PhysRewriter, ParallelScan) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1, parallel]\n" - " BindBlock:\n" - " [evalTemp_0]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1, parallel]\n", optimized); } @@ -4804,7 +4365,7 @@ TEST(PhysRewriter, HashPartitioning) { phaseManager.optimize(optimized); ASSERT_BETWEEN(5, 10, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pc\n" @@ -4821,12 +4382,7 @@ TEST(PhysRewriter, HashPartitioning) { "| aggregations: \n" "| [pc]\n" "| Variable [pb]\n" - "PhysicalScan [{'a': pa, 'b': pb}, c1]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n" - " [pb]\n" - " Source []\n", + "PhysicalScan [{'a': pa, 'b': pb}, c1]\n", optimized); } @@ -4895,7 +4451,7 @@ TEST(PhysRewriter, IndexPartitioning0) { phaseManager.optimize(optimized); ASSERT_BETWEEN(60, 100, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pc\n" @@ -4931,9 +4487,6 @@ TEST(PhysRewriter, IndexPartitioning0) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'b': pb}, c1]\n" - "| | BindBlock:\n" - "| | [pb]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "Exchange []\n" @@ -4941,12 +4494,7 @@ TEST(PhysRewriter, IndexPartitioning0) { "| | type: RoundRobin\n" "| RefBlock: \n" "IndexScan [{'<indexKey> 0': pa, '<rid>': rid_0}, scanDefName: c1, indexDefName: index1, " - "interval: {>Const [0]}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n", + "interval: {>Const [0]}]\n", optimized); } @@ -5087,7 +4635,7 @@ TEST(PhysRewriter, LocalGlobalAgg) { phaseManager.optimize(optimized); ASSERT_BETWEEN(15, 25, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -5122,12 +4670,7 @@ TEST(PhysRewriter, LocalGlobalAgg) { "| [preagg_0]\n" "| FunctionCall [$sum]\n" "| Variable [pb]\n" - "PhysicalScan [{'a': pa, 'b': pb}, c1, parallel]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n" - " [pb]\n" - " Source []\n", + "PhysicalScan [{'a': pa, 'b': pb}, c1, parallel]\n", optimized); } @@ -5166,7 +4709,7 @@ TEST(PhysRewriter, LocalGlobalAgg1) { phaseManager.optimize(optimized); ASSERT_BETWEEN(5, 15, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pc\n" @@ -5190,10 +4733,7 @@ TEST(PhysRewriter, LocalGlobalAgg1) { "| [preagg_0]\n" "| FunctionCall [$sum]\n" "| Variable [pb]\n" - "PhysicalScan [{'b': pb}, c1, parallel]\n" - " BindBlock:\n" - " [pb]\n" - " Source []\n", + "PhysicalScan [{'b': pb}, c1, parallel]\n", optimized); } @@ -5222,7 +4762,7 @@ TEST(PhysRewriter, LocalLimitSkip) { phaseManager.optimize(optimized); ASSERT_BETWEEN(5, 15, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_PROPS_V2( + ASSERT_EXPLAIN_PROPS_V2_AUTO( "Properties [cost: 0.00929774, localCost: 0, adjustedCE: 20]\n" "| | Logical:\n" "| | cardinalityEstimate: \n" @@ -5317,10 +4857,7 @@ TEST(PhysRewriter, LocalLimitSkip) { "| indexingRequirement: \n" "| Complete, dedupRID\n" "| limitEstimate: 30\n" - "PhysicalScan [{'<root>': root}, c1, parallel]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root}, c1, parallel]\n", phaseManager); } @@ -5357,7 +4894,7 @@ TEST(PhysRewriter, CollationLimit) { // We have a collation node with limit-skip physical properties. It will be lowered to a // sort node with limit. - ASSERT_EXPLAIN_PROPS_V2( + ASSERT_EXPLAIN_PROPS_V2_AUTO( "Properties [cost: 4.75042, localCost: 0, adjustedCE: 20]\n" "| | Logical:\n" "| | cardinalityEstimate: \n" @@ -5383,8 +4920,7 @@ TEST(PhysRewriter, CollationLimit) { "| | cardinalityEstimate: \n" "| | ce: 1000\n" "| | requirementCEs: \n" - "| | refProjection: root, path: 'PathGet [a] PathIdentity []', ce: " - "1000\n" + "| | refProjection: root, path: 'PathGet [a] PathIdentity []', ce: 1000\n" "| | projections: \n" "| | pa\n" "| | root\n" @@ -5417,8 +4953,7 @@ TEST(PhysRewriter, CollationLimit) { "| | cardinalityEstimate: \n" "| | ce: 1000\n" "| | requirementCEs: \n" - "| | refProjection: root, path: 'PathGet [a] PathIdentity []', ce: " - "1000\n" + "| | refProjection: root, path: 'PathGet [a] PathIdentity []', ce: 1000\n" "| | projections: \n" "| | pa\n" "| | root\n" @@ -5437,12 +4972,7 @@ TEST(PhysRewriter, CollationLimit) { "| type: Centralized\n" "| indexingRequirement: \n" "| Complete, dedupRID\n" - "PhysicalScan [{'<root>': root, 'a': pa}, c1]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'a': pa}, c1]\n", phaseManager); } @@ -5504,7 +5034,7 @@ TEST(PhysRewriter, PartialIndex1) { ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Partial schema requirement is not on an index field. We get a seek on this field. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -5523,18 +5053,10 @@ TEST(PhysRewriter, PartialIndex1) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root, 'b': evalTemp_4}, c1]\n" - "| | BindBlock:\n" - "| | [evalTemp_4]\n" - "| | Source []\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[3]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [3" + "]}]\n", optimized); } @@ -5586,7 +5108,7 @@ TEST(PhysRewriter, PartialIndex2) { ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Partial schema requirement on an index field. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -5599,16 +5121,10 @@ TEST(PhysRewriter, PartialIndex2) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[3]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [3" + "]}]\n", optimized); } @@ -5667,7 +5183,7 @@ TEST(PhysRewriter, PartialIndexReject) { ASSERT_EQ(3, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Incompatible partial filter. Use scan. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -5685,14 +5201,7 @@ TEST(PhysRewriter, PartialIndexReject) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [3]\n" - "PhysicalScan [{'<root>': root, 'a': evalTemp_2, 'b': evalTemp_3}, c1]\n" - " BindBlock:\n" - " [evalTemp_2]\n" - " Source []\n" - " [evalTemp_3]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'a': evalTemp_2, 'b': evalTemp_3}, c1]\n", optimized); } @@ -5726,7 +5235,7 @@ TEST(PhysRewriter, RequireRID) { ASSERT_EQ(2, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Make sure the Scan node returns rid, and the Root node refers to it. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | rid_0\n" @@ -5740,14 +5249,7 @@ TEST(PhysRewriter, RequireRID) { "| PathTraverse [1]\n" "| PathCompare [Eq]\n" "| Const [3]\n" - "PhysicalScan [{'<rid>': rid_0, '<root>': root, 'a': evalTemp_0}, c1]\n" - " BindBlock:\n" - " [evalTemp_0]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<rid>': rid_0, '<root>': root, 'a': evalTemp_0}, c1]\n", optimized); } @@ -5775,7 +5277,7 @@ TEST(PhysRewriter, RequireRID1) { phaseManager.optimize(optimized); ASSERT_EQ(3, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | rid_0\n" @@ -5785,12 +5287,7 @@ TEST(PhysRewriter, RequireRID1) { "| Variable [scan_0]\n" "Filter []\n" "| Const [true]\n" - "PhysicalScan [{'<rid>': rid_0, '<root>': scan_0}, c1]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n" - " [scan_0]\n" - " Source []\n", + "PhysicalScan [{'<rid>': rid_0, '<root>': scan_0}, c1]\n", optimized); } @@ -5839,24 +5336,15 @@ TEST(PhysRewriter, UnionRewrite) { phaseManager.optimize(optimized); ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pUnion1\n" "| RefBlock: \n" "| Variable [pUnion1]\n" - "Union []\n" - "| | BindBlock:\n" - "| | [pUnion1]\n" - "| | Source []\n" + "Union [{pUnion1}]\n" "| PhysicalScan [{'a': pUnion1}, test2]\n" - "| BindBlock:\n" - "| [pUnion1]\n" - "| Source []\n" - "PhysicalScan [{'a': pUnion1}, test1]\n" - " BindBlock:\n" - " [pUnion1]\n" - " Source []\n", + "PhysicalScan [{'a': pUnion1}, test1]\n", optimized); } @@ -5909,7 +5397,7 @@ TEST(PhysRewriter, JoinRewrite) { phaseManager.optimize(optimized); ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | p11\n" @@ -5917,22 +5405,12 @@ TEST(PhysRewriter, JoinRewrite) { "| RefBlock: \n" "| Variable [p11]\n" "| Variable [p21]\n" - "NestedLoopJoin [joinType: Inner]\n" + "NestedLoopJoin [joinType: Inner, ]\n" "| | BinaryOp [Eq]\n" "| | | Variable [p22]\n" "| | Variable [p12]\n" "| PhysicalScan [{'a': p21, 'b': p22}, test2]\n" - "| BindBlock:\n" - "| [p21]\n" - "| Source []\n" - "| [p22]\n" - "| Source []\n" - "PhysicalScan [{'a': p11, 'b': p12}, test1]\n" - " BindBlock:\n" - " [p11]\n" - " Source []\n" - " [p12]\n" - " Source []\n", + "PhysicalScan [{'a': p11, 'b': p12}, test1]\n", optimized); } @@ -5991,7 +5469,7 @@ TEST(PhysRewriter, JoinRewrite1) { ASSERT_EQ(6, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Demonstrate index nested loop join and variable interval intersection. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | p1\n" @@ -6003,13 +5481,7 @@ TEST(PhysRewriter, JoinRewrite1) { "| | Const [true]\n" "| IndexScan [{}, scanDefName: test2, indexDefName: index1, interval: {>If [] BinaryOp " "[Gte] Variable [p1] Variable [p2] Variable [p1] Variable [p2]}]\n" - "| BindBlock:\n" - "PhysicalScan [{'a1': p1, 'a2': p2}, test1]\n" - " BindBlock:\n" - " [p1]\n" - " Source []\n" - " [p2]\n" - " Source []\n", + "PhysicalScan [{'a1': p1, 'a2': p2}, test1]\n", optimized); } @@ -6041,7 +5513,7 @@ TEST(PhysRewriter, RootInterval) { phaseManager.optimize(optimized); ASSERT_EQ(2, phaseManager.getMemo().getStats()._physPlanExplorationCount); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -6052,10 +5524,7 @@ TEST(PhysRewriter, RootInterval) { "| | Variable [root]\n" "| PathCompare [Eq]\n" "| Const [1]\n" - "PhysicalScan [{'<root>': root}, c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root}, c1]\n", optimized); } @@ -6107,12 +5576,7 @@ TEST(PhysRewriter, ResidualFilterPathIsBalanced) { "| | Const [1]\n" "| PathCompare [Lte]\n" "| Const [0]\n" - "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1]\n" - " BindBlock:\n" - " [evalTemp_0]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1]\n", optimized); } @@ -6183,12 +5647,7 @@ TEST(PhysRewriter, DisjunctiveEqsConsolidatedIntoEqMember) { "| | Const [[1, 2, 3, 4, 5, 6, 7, 8]]\n" "| PathCompare [Lt]\n" "| Const [0]\n" - "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1]\n" - " BindBlock:\n" - " [evalTemp_0]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1]\n", optimized); } @@ -6235,12 +5694,7 @@ TEST(PhysRewriter, KeepBoundsForNothingCheck) { "| | Const [maxKey]\n" "| PathCompare [Gt]\n" "| Const [minKey]\n" - "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1]\n" - " BindBlock:\n" - " [evalTemp_0]\n" - " Source []\n" - " [root]\n" - " Source []\n", + "PhysicalScan [{'<root>': root, 'a': evalTemp_0}, c1]\n", optimized); } @@ -6279,31 +5733,28 @@ TEST(PhysRewriter, EqMemberSargable) { ABT optimized = rootNode; phaseManager.optimize(optimized); - ASSERT_EXPLAIN_V2_AUTO( // NOLINT (test auto-update) + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" "| RefBlock: \n" "| Variable [root]\n" "Sargable [Complete]\n" - "| | | | | requirementsMap: \n" - "| | | | | refProjection: root, path: 'PathGet [a] PathIdentity []', " - "intervals: {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}}\n" - "| | | | candidateIndexes: \n" - "| | | | candidateId: 1, index1, {}, {Compound}, {{{=Const [1]}} U " - "{{=Const [2]}} U {{=Const [3]}}}\n" - "| | | scanParams: \n" - "| | | {'a': evalTemp_0}\n" - "| | | residualReqs: \n" - "| | | refProjection: evalTemp_0, path: 'PathIdentity []', " - "intervals: {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}}, entryIndex: 0\n" - "| | BindBlock:\n" - "| RefBlock: \n" - "| Variable [root]\n" - "Scan [c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "| | | | requirementsMap: \n" + "| | | | refProjection: root, path: 'PathGet [a] PathIdentity []', " + "intervals:" + " {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}}\n" + "| | | candidateIndexes: \n" + "| | | candidateId: 1, index1, {}, {Compound}, {{{=Const [1]}} U {{=Const " + "[2]}}" + " U {{=Const [3]}}}\n" + "| | scanParams: \n" + "| | {'a': evalTemp_0}\n" + "| | residualReqs: \n" + "| | refProjection: evalTemp_0, path: 'PathIdentity []', intervals: " + "{{{=C" + "onst [1]}} U {{=Const [2]}} U {{=Const [3]}}}, entryIndex: 0\n" + "Scan [c1, {root}]\n", optimized); } @@ -6324,7 +5775,7 @@ TEST(PhysRewriter, EqMemberSargable) { ASSERT_EQ(4, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Test sargable filter is satisfied with an index scan. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | root\n" @@ -6337,9 +5788,6 @@ TEST(PhysRewriter, EqMemberSargable) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root}, c1]\n" - "| | BindBlock:\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "GroupBy []\n" @@ -6347,25 +5795,16 @@ TEST(PhysRewriter, EqMemberSargable) { "| | RefBlock: \n" "| | Variable [rid_0]\n" "| aggregations: \n" - "Union []\n" - "| | | BindBlock:\n" - "| | | [rid_0]\n" - "| | | Source []\n" + "Union [{rid_0}]\n" "| | IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: " - "{=Const [3]}]\n" - "| | BindBlock:\n" - "| | [rid_0]\n" - "| | Source []\n" + "{=" + "Const [3]}]\n" "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: " - "{=Const [2]}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" + "{=Cons" + "t [2]}]\n" "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[1]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "[1" + "]}]\n", optimized); } } @@ -6430,7 +5869,7 @@ TEST(PhysRewriter, IndexSubfieldCovered) { // Observe we have a covered plan. The filters for subfields "b" and "c" are expressed as // residual predicates. Also observe the traverse for "a.c" is removed due to "a" being // non-multikey. - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -6443,24 +5882,19 @@ TEST(PhysRewriter, IndexSubfieldCovered) { "| | Variable [pb]\n" "| PathCompare [Eq]\n" "| Const [2]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pb]\n" - "| EvalPath []\n" - "| | Variable [pa]\n" - "| PathGet [b]\n" - "| PathIdentity []\n" + "Evaluation [{pb}]\n" + "| EvalPath []\n" + "| | Variable [pa]\n" + "| PathGet [b]\n" + "| PathIdentity []\n" "Filter []\n" "| EvalFilter []\n" "| | Variable [pa]\n" "| PathGet [c]\n" "| PathCompare [Eq]\n" "| Const [3]\n" - "IndexScan [{'<indexKey> 0': pa}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[1]}]\n" - " BindBlock:\n" - " [pa]\n" - " Source []\n", + "IndexScan [{'<indexKey> 0': pa}, scanDefName: c1, indexDefName: index1, interval: {=Cons" + "t [1]}]\n", optimized); } @@ -6520,7 +5954,7 @@ TEST(PhysRewriter, PerfOnlyPreds1) { // Demonstrate predicates are repeated on the Seek side. Also demonstrate null handling, and the // fact that we apply the predicates on the Seek side in increasing selectivity order. - ASSERT_EXPLAIN_V2Compact( + ASSERT_EXPLAIN_V2Compact_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -6541,18 +5975,10 @@ TEST(PhysRewriter, PerfOnlyPreds1) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'a': pa, 'b': evalTemp_3}, c1]\n" - "| | BindBlock:\n" - "| | [evalTemp_3]\n" - "| | Source []\n" - "| | [pa]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[2], <Const [1]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [2" + "], <Const [1]}]\n", optimized); } @@ -6616,7 +6042,7 @@ TEST(PhysRewriter, PerfOnlyPreds2) { ASSERT_BETWEEN(10, 17, phaseManager.getMemo().getStats()._physPlanExplorationCount); // Demonstrate an intersection plan, with predicates repeated on the Seek side. - ASSERT_EXPLAIN_V2Compact( + ASSERT_EXPLAIN_V2Compact_AUTO( "Root []\n" "| | projections: \n" "| | pa\n" @@ -6637,11 +6063,6 @@ TEST(PhysRewriter, PerfOnlyPreds2) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'a': pa, 'b': evalTemp_2}, c1]\n" - "| | BindBlock:\n" - "| | [evalTemp_2]\n" - "| | Source []\n" - "| | [pa]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "MergeJoin []\n" @@ -6649,24 +6070,13 @@ TEST(PhysRewriter, PerfOnlyPreds2) { "| | | rid_0 = rid_5\n" "| | Collation\n" "| | Ascending\n" - "| Union []\n" - "| | BindBlock:\n" - "| | [rid_5]\n" - "| | Source []\n" - "| Evaluation []\n" - "| | BindBlock:\n" - "| | [rid_5]\n" - "| | Variable [rid_0]\n" - "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index2, interval: {=Const " - "[2]}]\n" - "| BindBlock:\n" - "| [rid_0]\n" - "| Source []\n" - "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const " - "[1]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "| Union [{rid_5}]\n" + "| Evaluation [{rid_5}]\n" + "| | Variable [rid_0]\n" + "| IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index2, interval: {=Cons" + "t [2]}]\n" + "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [1" + "]}]\n", optimized); } @@ -6738,11 +6148,6 @@ TEST(PhysRewriter, ConjunctionTraverseMultikey1) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root, 'a': evalTemp_11}, c1]\n" - "| | BindBlock:\n" - "| | [evalTemp_11]\n" - "| | Source []\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "Unique []\n" @@ -6755,12 +6160,7 @@ TEST(PhysRewriter, ConjunctionTraverseMultikey1) { "| PathCompare [Eq]\n" "| Const [1]\n" "IndexScan [{'<indexKey> 0': evalTemp_9, '<rid>': rid_0}, scanDefName: c1, indexDefName: " - "index1, interval: {<fully open>}]\n" - " BindBlock:\n" - " [evalTemp_9]\n" - " Source []\n" - " [rid_0]\n" - " Source []\n", + "index1, interval: {<fully open>}]\n", optimized); } @@ -6821,18 +6221,10 @@ TEST(PhysRewriter, ConjunctionTraverseMultikey2) { "| | limit: 1\n" "| | skip: 0\n" "| Seek [ridProjection: rid_0, {'<root>': root, 'a': evalTemp_5}, c1]\n" - "| | BindBlock:\n" - "| | [evalTemp_5]\n" - "| | Source []\n" - "| | [root]\n" - "| | Source []\n" "| RefBlock: \n" "| Variable [rid_0]\n" "IndexScan [{'<rid>': rid_0}, scanDefName: c1, indexDefName: index1, interval: {=Const [1" - "]}]\n" - " BindBlock:\n" - " [rid_0]\n" - " Source []\n", + "]}]\n", optimized); } diff --git a/src/mongo/db/query/optimizer/rewrites/path_optimizer_test.cpp b/src/mongo/db/query/optimizer/rewrites/path_optimizer_test.cpp index 5607c6383ea..3a717149888 100644 --- a/src/mongo/db/query/optimizer/rewrites/path_optimizer_test.cpp +++ b/src/mongo/db/query/optimizer/rewrites/path_optimizer_test.cpp @@ -191,40 +191,31 @@ TEST(Path, Fuse3) { auto tree = make<RootNode>(properties::ProjectionRequirement{ProjectionNameVector{"y"}}, std::move(project2)); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " y\n" " RefBlock: \n" " Variable [y]\n" - " Evaluation []\n" - " BindBlock:\n" - " [y]\n" + " Evaluation [{y}]\n" + " EvalPath []\n" + " PathGet [a]\n" + " PathTraverse [inf]\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [x]\n" + " Evaluation [{x}]\n" + " EvalPath []\n" + " PathField [a]\n" + " PathConstant []\n" + " Variable [z]\n" + " Variable [root]\n" + " Evaluation [{z}]\n" " EvalPath []\n" - " PathGet [a]\n" - " PathTraverse [inf]\n" - " PathConstant []\n" - " Const [2]\n" - " Variable [x]\n" - " Evaluation []\n" - " BindBlock:\n" - " [x]\n" - " EvalPath []\n" - " PathField [a]\n" - " PathConstant []\n" - " Variable [z]\n" - " Variable [root]\n" - " Evaluation []\n" - " BindBlock:\n" - " [z]\n" - " EvalPath []\n" - " PathGet [z]\n" - " PathIdentity []\n" - " Variable [root]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " PathGet [z]\n" + " PathIdentity []\n" + " Variable [root]\n" + " Scan [test, {root}]\n", tree); auto env = VariableEnvironment::build(tree); @@ -239,25 +230,20 @@ TEST(Path, Fuse3) { } } while (changed); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " y\n" " RefBlock: \n" " Variable [y]\n" - " Evaluation []\n" - " BindBlock:\n" - " [y]\n" - " EvalPath []\n" - " PathGet [z]\n" - " PathTraverse [inf]\n" - " PathConstant []\n" - " Const [2]\n" - " Variable [root]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " Evaluation [{y}]\n" + " EvalPath []\n" + " PathGet [z]\n" + " PathTraverse [inf]\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [root]\n" + " Scan [test, {root}]\n", tree); } @@ -299,7 +285,7 @@ TEST(Path, Fuse4) { auto tree = make<RootNode>(properties::ProjectionRequirement{ProjectionNameVector{"x", "y"}}, std::move(project2)); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " x\n" @@ -307,56 +293,43 @@ TEST(Path, Fuse4) { " RefBlock: \n" " Variable [x]\n" " Variable [y]\n" - " Evaluation []\n" - " BindBlock:\n" - " [y]\n" - " EvalPath []\n" - " PathGet [a]\n" - " PathTraverse [inf]\n" + " Evaluation [{y}]\n" + " EvalPath []\n" + " PathGet [a]\n" + " PathTraverse [inf]\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [x]\n" + " Evaluation [{x}]\n" + " EvalPath []\n" + " PathComposeM []\n" + " PathField [c]\n" + " PathConstant []\n" + " Variable [z2]\n" + " PathComposeM []\n" + " PathField [a]\n" " PathConstant []\n" - " Const [2]\n" - " Variable [x]\n" - " Evaluation []\n" - " BindBlock:\n" - " [x]\n" + " Variable [z]\n" + " PathField [b]\n" + " PathConstant []\n" + " Variable [z1]\n" + " Variable [root]\n" + " Evaluation [{z2}]\n" + " EvalPath []\n" + " PathGet [z2]\n" + " PathIdentity []\n" + " Variable [root]\n" + " Evaluation [{z1}]\n" " EvalPath []\n" - " PathComposeM []\n" - " PathField [c]\n" - " PathConstant []\n" - " Variable [z2]\n" - " PathComposeM []\n" - " PathField [a]\n" - " PathConstant []\n" - " Variable [z]\n" - " PathField [b]\n" - " PathConstant []\n" - " Variable [z1]\n" + " PathGet [z1]\n" + " PathIdentity []\n" " Variable [root]\n" - " Evaluation []\n" - " BindBlock:\n" - " [z2]\n" + " Evaluation [{z}]\n" " EvalPath []\n" - " PathGet [z2]\n" + " PathGet [z]\n" " PathIdentity []\n" " Variable [root]\n" - " Evaluation []\n" - " BindBlock:\n" - " [z1]\n" - " EvalPath []\n" - " PathGet [z1]\n" - " PathIdentity []\n" - " Variable [root]\n" - " Evaluation []\n" - " BindBlock:\n" - " [z]\n" - " EvalPath []\n" - " PathGet [z]\n" - " PathIdentity []\n" - " Variable [root]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " Scan [test, {root}]\n", tree); auto env = VariableEnvironment::build(tree); @@ -371,7 +344,7 @@ TEST(Path, Fuse4) { } } while (changed); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " x\n" @@ -379,47 +352,38 @@ TEST(Path, Fuse4) { " RefBlock: \n" " Variable [x]\n" " Variable [y]\n" - " Evaluation []\n" - " BindBlock:\n" - " [y]\n" - " EvalPath []\n" - " PathTraverse [inf]\n" + " Evaluation [{y}]\n" + " EvalPath []\n" + " PathTraverse [inf]\n" + " PathConstant []\n" + " Const [2]\n" + " Variable [z]\n" + " Evaluation [{x}]\n" + " EvalPath []\n" + " PathComposeM []\n" + " PathField [c]\n" " PathConstant []\n" - " Const [2]\n" - " Variable [z]\n" - " Evaluation []\n" - " BindBlock:\n" - " [x]\n" - " EvalPath []\n" - " PathComposeM []\n" - " PathField [c]\n" - " PathConstant []\n" - " EvalPath []\n" - " PathGet [z2]\n" - " PathIdentity []\n" - " Variable [root]\n" - " PathComposeM []\n" - " PathField [a]\n" - " PathConstant []\n" - " Variable [z]\n" - " PathField [b]\n" - " PathConstant []\n" - " EvalPath []\n" - " PathGet [z1]\n" - " PathIdentity []\n" - " Variable [root]\n" - " Variable [root]\n" - " Evaluation []\n" - " BindBlock:\n" - " [z]\n" - " EvalPath []\n" - " PathGet [z]\n" - " PathIdentity []\n" - " Variable [root]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " EvalPath []\n" + " PathGet [z2]\n" + " PathIdentity []\n" + " Variable [root]\n" + " PathComposeM []\n" + " PathField [a]\n" + " PathConstant []\n" + " Variable [z]\n" + " PathField [b]\n" + " PathConstant []\n" + " EvalPath []\n" + " PathGet [z1]\n" + " PathIdentity []\n" + " Variable [root]\n" + " Variable [root]\n" + " Evaluation [{z}]\n" + " EvalPath []\n" + " PathGet [z]\n" + " PathIdentity []\n" + " Variable [root]\n" + " Scan [test, {root}]\n", tree); } @@ -443,7 +407,7 @@ TEST(Path, Fuse5) { auto tree = make<RootNode>(properties::ProjectionRequirement{ProjectionNameVector{"x"}}, std::move(filter)); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " x\n" @@ -456,16 +420,11 @@ TEST(Path, Fuse5) { " PathCompare [Eq]\n" " Const [2]\n" " Variable [x]\n" - " Evaluation []\n" - " BindBlock:\n" - " [x]\n" - " EvalPath []\n" - " PathKeep [a, b, c]\n" - " Variable [root]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " Evaluation [{x}]\n" + " EvalPath []\n" + " PathKeep [a, b, c]\n" + " Variable [root]\n" + " Scan [test, {root}]\n", tree); auto env = VariableEnvironment::build(tree); @@ -481,7 +440,7 @@ TEST(Path, Fuse5) { } while (changed); // The filter now refers directly to the root projection. - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " x\n" @@ -494,16 +453,11 @@ TEST(Path, Fuse5) { " PathCompare [Eq]\n" " Const [2]\n" " Variable [root]\n" - " Evaluation []\n" - " BindBlock:\n" - " [x]\n" - " EvalPath []\n" - " PathKeep [a, b, c]\n" - " Variable [root]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " Evaluation [{x}]\n" + " EvalPath []\n" + " PathKeep [a, b, c]\n" + " Variable [root]\n" + " Scan [test, {root}]\n", tree); } @@ -522,28 +476,23 @@ TEST(Path, Fuse6) { auto tree = make<RootNode>(properties::ProjectionRequirement{ProjectionNameVector{"x"}}, std::move(project)); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " x\n" " RefBlock: \n" " Variable [x]\n" - " Evaluation []\n" - " BindBlock:\n" - " [x]\n" - " EvalPath []\n" - " PathComposeM []\n" - " PathComposeM []\n" - " PathObj []\n" - " PathKeep [a, b, c]\n" - " PathField [a]\n" - " PathConstant []\n" - " Const [{}]\n" - " Variable [root]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " Evaluation [{x}]\n" + " EvalPath []\n" + " PathComposeM []\n" + " PathComposeM []\n" + " PathObj []\n" + " PathKeep [a, b, c]\n" + " PathField [a]\n" + " PathConstant []\n" + " Const [{}]\n" + " Variable [root]\n" + " Scan [test, {root}]\n", tree); auto env = VariableEnvironment::build(tree); @@ -559,26 +508,21 @@ TEST(Path, Fuse6) { } while (changed); // PathObj is removed. - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " x\n" " RefBlock: \n" " Variable [x]\n" - " Evaluation []\n" - " BindBlock:\n" - " [x]\n" - " EvalPath []\n" - " PathComposeM []\n" - " PathKeep [a, b, c]\n" - " PathField [a]\n" - " PathConstant []\n" - " Const [{}]\n" - " Variable [root]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " Evaluation [{x}]\n" + " EvalPath []\n" + " PathComposeM []\n" + " PathKeep [a, b, c]\n" + " PathField [a]\n" + " PathConstant []\n" + " Const [{}]\n" + " Variable [root]\n" + " Scan [test, {root}]\n", tree); } @@ -603,36 +547,29 @@ TEST(Path, Fuse7) { auto tree = make<RootNode>(properties::ProjectionRequirement{ProjectionNameVector{"py"}}, std::move(project2)); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " py\n" " RefBlock: \n" " Variable [py]\n" - " Evaluation []\n" - " BindBlock:\n" - " [py]\n" - " EvalPath []\n" - " PathComposeM []\n" - " PathComposeM []\n" - " PathKeep [a]\n" - " PathField [a]\n" - " PathConstant []\n" - " Variable [px]\n" - " PathDefault []\n" - " Const [{}]\n" - " Variable [root]\n" - " Evaluation []\n" - " BindBlock:\n" - " [px]\n" - " EvalPath []\n" - " PathGet [x]\n" - " PathIdentity []\n" - " Variable [root]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " Evaluation [{py}]\n" + " EvalPath []\n" + " PathComposeM []\n" + " PathComposeM []\n" + " PathKeep [a]\n" + " PathField [a]\n" + " PathConstant []\n" + " Variable [px]\n" + " PathDefault []\n" + " Const [{}]\n" + " Variable [root]\n" + " Evaluation [{px}]\n" + " EvalPath []\n" + " PathGet [x]\n" + " PathIdentity []\n" + " Variable [root]\n" + " Scan [test, {root}]\n", tree); auto env = VariableEnvironment::build(tree); @@ -648,27 +585,22 @@ TEST(Path, Fuse7) { } while (changed); // Obtain "x" and directly assign at "a". - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " py\n" " RefBlock: \n" " Variable [py]\n" - " Evaluation []\n" - " BindBlock:\n" - " [py]\n" - " EvalPath []\n" - " PathField [a]\n" - " PathConstant []\n" - " EvalPath []\n" - " PathGet [x]\n" - " PathIdentity []\n" - " Variable [root]\n" - " Const [{}]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " Evaluation [{py}]\n" + " EvalPath []\n" + " PathField [a]\n" + " PathConstant []\n" + " EvalPath []\n" + " PathGet [x]\n" + " PathIdentity []\n" + " Variable [root]\n" + " Const [{}]\n" + " Scan [test, {root}]\n", tree); } @@ -757,7 +689,7 @@ TEST(Path, LowerPathGetPathLambda) { runPathLowering(env, prefixId, tree); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "BinaryOp [Add]\n" " FunctionCall [getField]\n" " FunctionCall [getField]\n" @@ -786,21 +718,16 @@ TEST(Path, ProjElim1) { runPathLowering(env, prefixId, tree); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " y\n" " RefBlock: \n" " Variable [y]\n" - " Evaluation []\n" - " BindBlock:\n" - " [y]\n" - " FunctionCall [anyFunctionWillDo]\n" - " Variable [root]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " Evaluation [{y}]\n" + " FunctionCall [anyFunctionWillDo]\n" + " Variable [root]\n" + " Scan [test, {root}]\n", tree); } @@ -821,14 +748,11 @@ TEST(Path, ProjElim2) { runPathLowering(env, prefixId, tree); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " RefBlock: \n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " Scan [test, {root}]\n", tree); } @@ -859,20 +783,15 @@ TEST(Path, ProjElim3) { } } while (changed); - ASSERT_EXPLAIN( + ASSERT_EXPLAIN_AUTO( "Root []\n" " projections: \n" " p99\n" " RefBlock: \n" " Variable [p99]\n" - " Evaluation []\n" - " BindBlock:\n" - " [p99]\n" - " Variable [root]\n" - " Scan [test]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + " Evaluation [{p99}]\n" + " Variable [root]\n" + " Scan [test, {root}]\n", tree); } diff --git a/src/mongo/db/query/optimizer/unit_test_infra_test.cpp b/src/mongo/db/query/optimizer/unit_test_infra_test.cpp index 43ae5645bb6..18ee6394fb9 100644 --- a/src/mongo/db/query/optimizer/unit_test_infra_test.cpp +++ b/src/mongo/db/query/optimizer/unit_test_infra_test.cpp @@ -159,7 +159,7 @@ TEST(TestInfra, ABTLiterals) { auto groupByNode = _gb(_varnames("pa"), _varnames("pc"), {"pb"_var}, std::move(filterBNode)); auto rootNode = _root("pc")(std::move(groupByNode)); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pc\n" @@ -177,29 +177,22 @@ TEST(TestInfra, ABTLiterals) { "| | Variable [pb]\n" "| PathCompare [Gt]\n" "| Const [1]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pb]\n" - "| EvalPath []\n" - "| | Variable [root]\n" - "| PathGet [b]\n" - "| PathIdentity []\n" + "Evaluation [{pb}]\n" + "| EvalPath []\n" + "| | Variable [root]\n" + "| PathGet [b]\n" + "| PathIdentity []\n" "Filter []\n" "| EvalFilter []\n" "| | Variable [pa]\n" "| PathCompare [Gt]\n" "| Const [0]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pa]\n" - "| EvalPath []\n" - "| | Variable [root]\n" - "| PathGet [a]\n" - "| PathIdentity []\n" - "Scan [c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "Evaluation [{pa}]\n" + "| EvalPath []\n" + "| | Variable [root]\n" + "| PathGet [a]\n" + "| PathIdentity []\n" + "Scan [c1, {root}]\n", rootNode); // Construct using a builder. Note we construct the tree in a top-to-bottom fashion. @@ -212,7 +205,7 @@ TEST(TestInfra, ABTLiterals) { .eval("pa", _evalp(_get("a", _id()), "root"_var)) .finish(_scan("root", "c1")); - ASSERT_EXPLAIN_V2( + ASSERT_EXPLAIN_V2_AUTO( "Root []\n" "| | projections: \n" "| | pc\n" @@ -230,29 +223,22 @@ TEST(TestInfra, ABTLiterals) { "| | Variable [pb]\n" "| PathCompare [Gt]\n" "| Const [1]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pb]\n" - "| EvalPath []\n" - "| | Variable [root]\n" - "| PathGet [b]\n" - "| PathIdentity []\n" + "Evaluation [{pb}]\n" + "| EvalPath []\n" + "| | Variable [root]\n" + "| PathGet [b]\n" + "| PathIdentity []\n" "Filter []\n" "| EvalFilter []\n" "| | Variable [pa]\n" "| PathCompare [Gt]\n" "| Const [0]\n" - "Evaluation []\n" - "| BindBlock:\n" - "| [pa]\n" - "| EvalPath []\n" - "| | Variable [root]\n" - "| PathGet [a]\n" - "| PathIdentity []\n" - "Scan [c1]\n" - " BindBlock:\n" - " [root]\n" - " Source []\n", + "Evaluation [{pa}]\n" + "| EvalPath []\n" + "| | Variable [root]\n" + "| PathGet [a]\n" + "| PathIdentity []\n" + "Scan [c1, {root}]\n", rootNode1); } diff --git a/src/mongo/db/query/optimizer/utils/unit_test_utils.h b/src/mongo/db/query/optimizer/utils/unit_test_utils.h index 3c782d5fdd1..7d9c4318ad7 100644 --- a/src/mongo/db/query/optimizer/utils/unit_test_utils.h +++ b/src/mongo/db/query/optimizer/utils/unit_test_utils.h @@ -88,17 +88,15 @@ bool handleAutoUpdate(const std::string& expected, maybePrintABT(abt); \ ASSERT_EQ(expected, ExplainGenerator::explain(abt)) -// Do not remove macro even if unused: used to update tests before committing code. #define ASSERT_EXPLAIN_AUTO(expected, abt) \ maybePrintABT(abt); \ - ASSERT_STR_EQ(expected, ExplainGenerator::explain(abt)) + ASSERT_STR_EQ_AUTO(expected, ExplainGenerator::explain(abt)) #define ASSERT_EXPLAIN_V2(expected, abt) \ maybePrintABT(abt); \ ASSERT_EQ(expected, ExplainGenerator::explainV2(abt)) -// Do not remove macro even if unused: used to update tests before committing code. #define ASSERT_EXPLAIN_V2_AUTO(expected, abt) \ maybePrintABT(abt); \ ASSERT_STR_EQ_AUTO(expected, ExplainGenerator::explainV2(abt)) @@ -108,7 +106,6 @@ bool handleAutoUpdate(const std::string& expected, maybePrintABT(abt); \ ASSERT_EQ(expected, ExplainGenerator::explainV2Compact(abt)) -// Do not remove macro even if unused: used to update tests before committing code. #define ASSERT_EXPLAIN_V2Compact_AUTO(expected, abt) \ maybePrintABT(abt); \ ASSERT_STR_EQ_AUTO(expected, ExplainGenerator::explainV2Compact(abt)) @@ -127,14 +124,12 @@ bool handleAutoUpdate(const std::string& expected, #define ASSERT_EXPLAIN_PROPS_V2(expected, phaseManager) \ ASSERT_EQ(expected, getPropsStrForExplain(phaseManager)) -// Do not remove macro even if unused: used to update tests before committing code. #define ASSERT_EXPLAIN_PROPS_V2_AUTO(expected, phaseManager) \ ASSERT_STR_EQ_AUTO(expected, getPropsStrForExplain(phaseManager)) #define ASSERT_EXPLAIN_MEMO(expected, memo) ASSERT_EQ(expected, ExplainGenerator::explainMemo(memo)) -// Do not remove macro even if unused: used to update tests before committing code. #define ASSERT_EXPLAIN_MEMO_AUTO(expected, memo) \ ASSERT_STR_EQ_AUTO(expected, ExplainGenerator::explainMemo(memo)) @@ -142,7 +137,6 @@ bool handleAutoUpdate(const std::string& expected, #define ASSERT_INTERVAL(expected, interval) \ ASSERT_EQ(expected, ExplainGenerator::explainIntervalExpr(interval)) -// Do not remove macro even if unused: used to update tests before committing code. #define ASSERT_INTERVAL_AUTO(expected, interval) \ ASSERT_STR_EQ_AUTO(expected, ExplainGenerator::explainIntervalExpr(interval)) diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_collation_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_collation_node.txt index 7a53f4569bf..d731d32402a 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_collation_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_collation_node.txt @@ -7,16 +7,11 @@ Collation [] | | sortA: Ascending | RefBlock: | Variable [sortA] -Evaluation [] -| BindBlock: -| [sortA] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{sortA}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [0] sort [s2] [asc] [] @@ -32,22 +27,15 @@ Collation [] | RefBlock: | Variable [sortA] | Variable [sortB] -Evaluation [] -| BindBlock: -| [sortB] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [sortA] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{sortB}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{sortA}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [0] sort [s2, s3] [asc, desc] [] diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_exchange_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_exchange_node.txt index 6a325870625..f520e4eb77a 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_exchange_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_exchange_node.txt @@ -9,16 +9,11 @@ Exchange [] | | proj0 | RefBlock: | Variable [proj0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [0] exchange [s2] 1 hash @@ -34,16 +29,11 @@ Exchange [] | | proj0 | RefBlock: | Variable [proj0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [0] exchange [s2] 1 bcast @@ -59,16 +49,11 @@ Exchange [] | | proj0 | RefBlock: | Variable [proj0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [0] exchange [s2] 1 round @@ -84,16 +69,11 @@ Exchange [] | | proj0 | RefBlock: | Variable [proj0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [0] exchange [s2] 1 bcast diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_filter_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_filter_node.txt index 581fd6d97c0..53870362759 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_filter_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_filter_node.txt @@ -13,9 +13,6 @@ Filter [] | | Const ["a"] | Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [1] filter {(((getField(s1, "a") <=> 23) >= 0ll) ?: false)} @@ -28,9 +25,6 @@ Filter [] | | Const [false] | Const [true] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [1] cfilter {(true ?: false)} diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_group_by_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_group_by_node.txt index 8fbe7034dce..4bba1f572ee 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_group_by_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_group_by_node.txt @@ -11,28 +11,19 @@ GroupBy [] | [outFunc1] | FunctionCall [$sum] | Variable [aggInput1] -Evaluation [] -| BindBlock: -| [aggInput1] -| FunctionCall [getField] -| | Const ["c"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key2] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key1] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{aggInput1}] +| FunctionCall [getField] +| | Const ["c"] +| Variable [scan0] +Evaluation [{key2}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{key1}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] group [s2, s3] [s5 = sum(s4)] @@ -55,34 +46,23 @@ GroupBy [] | [outFunc2] | FunctionCall [$sum] | Variable [aggInput2] -Evaluation [] -| BindBlock: -| [aggInput2] -| FunctionCall [getField] -| | Const ["d"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [aggInput1] -| FunctionCall [getField] -| | Const ["c"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key2] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key1] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{aggInput2}] +| FunctionCall [getField] +| | Const ["d"] +| Variable [scan0] +Evaluation [{aggInput1}] +| FunctionCall [getField] +| | Const ["c"] +| Variable [scan0] +Evaluation [{key2}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{key1}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [5] group [s2, s3] [s6 = sum(s4), s7 = sum(s5)] @@ -103,28 +83,19 @@ GroupBy [Local] | [outFunc1] | FunctionCall [$sum] | Variable [aggInput1] -Evaluation [] -| BindBlock: -| [aggInput1] -| FunctionCall [getField] -| | Const ["c"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key2] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key1] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{aggInput1}] +| FunctionCall [getField] +| | Const ["c"] +| Variable [scan0] +Evaluation [{key2}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{key1}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] group [s2, s3] [s5 = sum(s4)] @@ -147,34 +118,23 @@ GroupBy [Local] | [outFunc2] | FunctionCall [$sum] | Variable [aggInput2] -Evaluation [] -| BindBlock: -| [aggInput2] -| FunctionCall [getField] -| | Const ["d"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [aggInput1] -| FunctionCall [getField] -| | Const ["c"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key2] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key1] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{aggInput2}] +| FunctionCall [getField] +| | Const ["d"] +| Variable [scan0] +Evaluation [{aggInput1}] +| FunctionCall [getField] +| | Const ["c"] +| Variable [scan0] +Evaluation [{key2}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{key1}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [5] group [s2, s3] [s6 = sum(s4), s7 = sum(s5)] @@ -195,28 +155,19 @@ GroupBy [Global] | [outFunc1] | FunctionCall [$sum] | Variable [aggInput1] -Evaluation [] -| BindBlock: -| [aggInput1] -| FunctionCall [getField] -| | Const ["c"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key2] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key1] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{aggInput1}] +| FunctionCall [getField] +| | Const ["c"] +| Variable [scan0] +Evaluation [{key2}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{key1}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] group [s2, s3] [s5 = sum(s4)] @@ -239,34 +190,23 @@ GroupBy [Global] | [outFunc2] | FunctionCall [$sum] | Variable [aggInput2] -Evaluation [] -| BindBlock: -| [aggInput2] -| FunctionCall [getField] -| | Const ["d"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [aggInput1] -| FunctionCall [getField] -| | Const ["c"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key2] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [key1] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{aggInput2}] +| FunctionCall [getField] +| | Const ["d"] +| Variable [scan0] +Evaluation [{aggInput1}] +| FunctionCall [getField] +| | Const ["c"] +| Variable [scan0] +Evaluation [{key2}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{key1}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [5] group [s2, s3] [s6 = sum(s4), s7 = sum(s5)] diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_hash_join_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_hash_join_node.txt index 6632e2d4051..018cd2068d1 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_hash_join_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_hash_join_node.txt @@ -5,26 +5,16 @@ HashJoin [joinType: Inner] | | Condition | | otherID = ID -| Evaluation [] -| | BindBlock: -| | [ID] -| | FunctionCall [getField] -| | | Const ["id"] -| | Variable [scan1] +| Evaluation [{ID}] +| | FunctionCall [getField] +| | | Const ["id"] +| | Variable [scan1] | PhysicalScan [{'<root>': scan1}, otherColl] -| BindBlock: -| [scan1] -| Source [] -Evaluation [] -| BindBlock: -| [otherID] -| FunctionCall [getField] -| | Const ["other_id"] -| Variable [scan0] +Evaluation [{otherID}] +| FunctionCall [getField] +| | Const ["other_id"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] hj @@ -42,38 +32,24 @@ HashJoin [joinType: Inner] | | Condition | | proj0 = proj2 | | proj1 = proj3 -| Evaluation [] -| | BindBlock: -| | [proj3] -| | FunctionCall [getField] -| | | Const ["state_id"] -| | Variable [scan1] -| Evaluation [] -| | BindBlock: -| | [proj2] -| | FunctionCall [getField] -| | | Const ["cityField"] -| | Variable [scan1] +| Evaluation [{proj3}] +| | FunctionCall [getField] +| | | Const ["state_id"] +| | Variable [scan1] +| Evaluation [{proj2}] +| | FunctionCall [getField] +| | | Const ["cityField"] +| | Variable [scan1] | PhysicalScan [{'<root>': scan1}, otherColl] -| BindBlock: -| [scan1] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["state"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["city"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["state"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["city"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] hj diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_index_scan_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_index_scan_node.txt index bb40e329b73..594e795a6ba 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_index_scan_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_index_scan_node.txt @@ -3,9 +3,6 @@ ==== VARIATION: Basic forward index scan with RID ==== -- INPUT: IndexScan [{'<rid>': rid}, scanDefName: collName, indexDefName: index0, interval: {(Const [23], Const [35]]}] - BindBlock: - [rid] - Source [] -- OUTPUT: [0] ixseek ks(2ll, 0, 23L, 2ll) ks(2ll, 0, 35L, 2ll) none s1 none [] @"<collUUID>" @"<collUUID>" true @@ -13,9 +10,6 @@ IndexScan [{'<rid>': rid}, scanDefName: collName, indexDefName: index0, interval ==== VARIATION: Covering forward index scan with one field ==== -- INPUT: IndexScan [{'<indexKey> 0': proj0}, scanDefName: collName, indexDefName: index0, interval: {[Const [26], Const [35])}] - BindBlock: - [proj0] - Source [] -- OUTPUT: [0] ixseek ks(2ll, 0, 26L, 1ll) ks(2ll, 0, 35L, 1ll) none none none [s1 = 0] @"<collUUID>" @"<collUUID>" true @@ -23,9 +17,6 @@ IndexScan [{'<indexKey> 0': proj0}, scanDefName: collName, indexDefName: index0, ==== VARIATION: Basic reverse index scan with RID ==== -- INPUT: IndexScan [{'<rid>': rid}, scanDefName: collName, indexDefName: index0, interval: {[Const [27], Const [135])}, reversed] - BindBlock: - [rid] - Source [] -- OUTPUT: [0] ixseek ks(2ll, 0, 27L, 1ll) ks(2ll, 0, 135L, 1ll) none s1 none [] @"<collUUID>" @"<collUUID>" false @@ -33,9 +24,6 @@ IndexScan [{'<rid>': rid}, scanDefName: collName, indexDefName: index0, interval ==== VARIATION: Covering reverse index scan with one field ==== -- INPUT: IndexScan [{'<indexKey> 0': proj0}, scanDefName: collName, indexDefName: index0, interval: {[Const [29], Const [47]]}, reversed] - BindBlock: - [proj0] - Source [] -- OUTPUT: [0] ixseek ks(2ll, 0, 29L, 1ll) ks(2ll, 0, 47L, 2ll) none none none [s1 = 0] @"<collUUID>" @"<collUUID>" false diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_limit_skip_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_limit_skip_node.txt index fbdf2d7f21a..dfa49bd0541 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_limit_skip_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_limit_skip_node.txt @@ -7,9 +7,6 @@ LimitSkip [] | limit: 5 | skip: 0 PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [1] limitskip 5 0 @@ -22,9 +19,6 @@ LimitSkip [] | limit: 0 | skip: 4 PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [1] limitskip 0 4 @@ -37,9 +31,6 @@ LimitSkip [] | limit: 4 | skip: 2 PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [1] limitskip 4 2 diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_merge_join_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_merge_join_node.txt index add1bada248..b6e854d55a9 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_merge_join_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_merge_join_node.txt @@ -7,26 +7,16 @@ MergeJoin [] | | | proj0 = proj1 | | Collation | | Ascending -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["id"] -| | Variable [scan1] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["id"] +| | Variable [scan1] | PhysicalScan [{'<root>': scan1}, otherColl] -| BindBlock: -| [scan1] -| Source [] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["other_id"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["other_id"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] mj @@ -45,26 +35,16 @@ MergeJoin [] | | | proj0 = proj1 | | Collation | | Descending -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["id"] -| | Variable [scan1] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["id"] +| | Variable [scan1] | PhysicalScan [{'<root>': scan1}, otherColl] -| BindBlock: -| [scan1] -| Source [] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["other_id"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["other_id"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] mj @@ -85,38 +65,24 @@ MergeJoin [] | | Collation | | Ascending | | Ascending -| Evaluation [] -| | BindBlock: -| | [proj3] -| | FunctionCall [getField] -| | | Const ["city"] -| | Variable [scan1] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["id"] -| | Variable [scan1] +| Evaluation [{proj3}] +| | FunctionCall [getField] +| | | Const ["city"] +| | Variable [scan1] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["id"] +| | Variable [scan1] | PhysicalScan [{'<root>': scan1}, otherColl] -| BindBlock: -| [scan1] -| Source [] -Evaluation [] -| BindBlock: -| [proj2] -| FunctionCall [getField] -| | Const ["city"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["other_id"] -| Variable [scan0] +Evaluation [{proj2}] +| FunctionCall [getField] +| | Const ["city"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["other_id"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] mj @@ -139,38 +105,24 @@ MergeJoin [] | | Collation | | Ascending | | Descending -| Evaluation [] -| | BindBlock: -| | [proj3] -| | FunctionCall [getField] -| | | Const ["city"] -| | Variable [scan1] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["id"] -| | Variable [scan1] +| Evaluation [{proj3}] +| | FunctionCall [getField] +| | | Const ["city"] +| | Variable [scan1] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["id"] +| | Variable [scan1] | PhysicalScan [{'<root>': scan1}, otherColl] -| BindBlock: -| [scan1] -| Source [] -Evaluation [] -| BindBlock: -| [proj2] -| FunctionCall [getField] -| | Const ["city"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["other_id"] -| Variable [scan0] +Evaluation [{proj2}] +| FunctionCall [getField] +| | Const ["city"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["other_id"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] mj @@ -193,38 +145,24 @@ MergeJoin [] | | Collation | | Descending | | Ascending -| Evaluation [] -| | BindBlock: -| | [proj3] -| | FunctionCall [getField] -| | | Const ["city"] -| | Variable [scan1] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["id"] -| | Variable [scan1] +| Evaluation [{proj3}] +| | FunctionCall [getField] +| | | Const ["city"] +| | Variable [scan1] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["id"] +| | Variable [scan1] | PhysicalScan [{'<root>': scan1}, otherColl] -| BindBlock: -| [scan1] -| Source [] -Evaluation [] -| BindBlock: -| [proj2] -| FunctionCall [getField] -| | Const ["city"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["other_id"] -| Variable [scan0] +Evaluation [{proj2}] +| FunctionCall [getField] +| | Const ["city"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["other_id"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] mj @@ -247,38 +185,24 @@ MergeJoin [] | | Collation | | Descending | | Descending -| Evaluation [] -| | BindBlock: -| | [proj3] -| | FunctionCall [getField] -| | | Const ["city"] -| | Variable [scan1] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["id"] -| | Variable [scan1] +| Evaluation [{proj3}] +| | FunctionCall [getField] +| | | Const ["city"] +| | Variable [scan1] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["id"] +| | Variable [scan1] | PhysicalScan [{'<root>': scan1}, otherColl] -| BindBlock: -| [scan1] -| Source [] -Evaluation [] -| BindBlock: -| [proj2] -| FunctionCall [getField] -| | Const ["city"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["other_id"] -| Variable [scan0] +Evaluation [{proj2}] +| FunctionCall [getField] +| | Const ["city"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["other_id"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] mj diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_multiple_evaluation_nodes.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_multiple_evaluation_nodes.txt index 3750dfa9bf4..5ad8432c380 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_multiple_evaluation_nodes.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_multiple_evaluation_nodes.txt @@ -2,22 +2,15 @@ ==== VARIATION: Lower two chained evaluation nodes ==== -- INPUT: -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [2] project [s3 = getField(s1, "b")] diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_nested_loop_join_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_nested_loop_join_node.txt index 29764e12e1c..89562feecbb 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_nested_loop_join_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_nested_loop_join_node.txt @@ -8,26 +8,16 @@ NestedLoopJoin [joinType: Inner, {proj0}] | | BinaryOp [Eq] | | | Variable [proj1] | | Variable [proj0] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["id"] -| | Variable [scan1] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["id"] +| | Variable [scan1] | PhysicalScan [{'<root>': scan1}, otherColl] -| BindBlock: -| [scan1] -| Source [] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["city"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["city"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] nlj inner [] [s2] {((s2 == s4) ?: false)} @@ -47,26 +37,16 @@ NestedLoopJoin [joinType: Left, {proj0}] | | BinaryOp [Eq] | | | Variable [proj1] | | Variable [proj0] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["id"] -| | Variable [scan1] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["id"] +| | Variable [scan1] | PhysicalScan [{'<root>': scan1}, otherColl] -| BindBlock: -| [scan1] -| Source [] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["city"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["city"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] nlj left [] [s2] {((s2 == s4) ?: false)} diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_physical_scan_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_physical_scan_node.txt index 446e270491f..0b689e3bdc3 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_physical_scan_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_physical_scan_node.txt @@ -3,9 +3,6 @@ ==== VARIATION: Physical scan with root projection (not parallel) ==== -- INPUT: PhysicalScan [{'<root>': root0}, collName] - BindBlock: - [root0] - Source [] -- OUTPUT: [0] scan s1 none none none none none [] @"<collUUID>" true false @@ -13,9 +10,6 @@ PhysicalScan [{'<root>': root0}, collName] ==== VARIATION: Physical scan with RID projection (not parallel) ==== -- INPUT: PhysicalScan [{'<rid>': RID0}, collName] - BindBlock: - [RID0] - Source [] -- OUTPUT: [0] scan none s1 none none none none [] @"<collUUID>" true false @@ -23,11 +17,6 @@ PhysicalScan [{'<rid>': RID0}, collName] ==== VARIATION: Physical scan with root and RID projections (not parallel) ==== -- INPUT: PhysicalScan [{'<rid>': RID0, '<root>': root0}, collName] - BindBlock: - [RID0] - Source [] - [root0] - Source [] -- OUTPUT: [0] scan s2 s1 none none none none [] @"<collUUID>" true false @@ -35,13 +24,6 @@ PhysicalScan [{'<rid>': RID0, '<root>': root0}, collName] ==== VARIATION: Physical scan with root, RID and field projections (not parallel) ==== -- INPUT: PhysicalScan [{'<rid>': RID0, '<root>': root0, 'field': field2}, collName] - BindBlock: - [RID0] - Source [] - [field2] - Source [] - [root0] - Source [] -- OUTPUT: [0] scan s2 s1 none none none none [s3 = field] @"<collUUID>" true false @@ -49,9 +31,6 @@ PhysicalScan [{'<rid>': RID0, '<root>': root0, 'field': field2}, collName] ==== VARIATION: Physical scan with root projection (parallel) ==== -- INPUT: PhysicalScan [{'<root>': root0}, collName, parallel] - BindBlock: - [root0] - Source [] -- OUTPUT: [0] pscan s1 none none none none none [] @"<collUUID>" @@ -59,9 +38,6 @@ PhysicalScan [{'<root>': root0}, collName, parallel] ==== VARIATION: Physical scan with RID projection (parallel) ==== -- INPUT: PhysicalScan [{'<rid>': RID0}, collName, parallel] - BindBlock: - [RID0] - Source [] -- OUTPUT: [0] pscan none s1 none none none none [] @"<collUUID>" @@ -69,11 +45,6 @@ PhysicalScan [{'<rid>': RID0}, collName, parallel] ==== VARIATION: Physical scan with root and RID projections (parallel) ==== -- INPUT: PhysicalScan [{'<rid>': RID0, '<root>': root0}, collName, parallel] - BindBlock: - [RID0] - Source [] - [root0] - Source [] -- OUTPUT: [0] pscan s2 s1 none none none none [] @"<collUUID>" @@ -81,13 +52,6 @@ PhysicalScan [{'<rid>': RID0, '<root>': root0}, collName, parallel] ==== VARIATION: Physical scan with root, RID and field projections (parallel) ==== -- INPUT: PhysicalScan [{'<rid>': RID0, '<root>': root0, 'field': field2}, collName, parallel] - BindBlock: - [RID0] - Source [] - [field2] - Source [] - [root0] - Source [] -- OUTPUT: [0] pscan s2 s1 none none none none [s3 = field] @"<collUUID>" diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_seek_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_seek_node.txt index 642a81062aa..3b54be5eaff 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_seek_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_seek_node.txt @@ -9,15 +9,9 @@ NestedLoopJoin [joinType: Inner, {rid}] | | limit: 1 | | skip: 0 | Seek [ridProjection: rid, {'<root>': scan0}, collName] -| | BindBlock: -| | [scan0] -| | Source [] | RefBlock: | Variable [rid] IndexScan [{'<rid>': rid}, scanDefName: collName, indexDefName: index0, interval: {(Const [23], Const [35]]}] - BindBlock: - [rid] - Source [] -- OUTPUT: [3] nlj inner [] [s1] {true} diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_sorted_merge_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_sorted_merge_node.txt index 247caec33be..b983e001790 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_sorted_merge_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_sorted_merge_node.txt @@ -5,25 +5,15 @@ SortedMerge [] | | collation: | | proj0: Ascending -| BindBlock: -| [proj0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [3] smerge [s4] [asc] [ @@ -37,41 +27,24 @@ PhysicalScan [{'<root>': scan0}, collName] SortedMerge [] | | | collation: | | | proj0: Ascending -| | BindBlock: -| | [proj0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] smerge [s7] [asc] [ @@ -88,89 +61,51 @@ PhysicalScan [{'<root>': scan0}, collName] SortedMerge [] | | | | | | collation: | | | | | | proj0: Ascending -| | | | | BindBlock: -| | | | | [proj0] -| | | | | Source [] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj1] -| | | | | FunctionCall [getField] -| | | | | | Const ["b"] -| | | | | Variable [scan0] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj0] -| | | | | FunctionCall [getField] -| | | | | | Const ["a"] -| | | | | Variable [scan0] +| | | | Evaluation [{proj1}] +| | | | | FunctionCall [getField] +| | | | | | Const ["b"] +| | | | | Variable [scan0] +| | | | Evaluation [{proj0}] +| | | | | FunctionCall [getField] +| | | | | | Const ["a"] +| | | | | Variable [scan0] | | | | PhysicalScan [{'<root>': scan0}, collName] -| | | | BindBlock: -| | | | [scan0] -| | | | Source [] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj1] -| | | | FunctionCall [getField] -| | | | | Const ["b"] -| | | | Variable [scan0] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj0] -| | | | FunctionCall [getField] -| | | | | Const ["a"] -| | | | Variable [scan0] +| | | Evaluation [{proj1}] +| | | | FunctionCall [getField] +| | | | | Const ["b"] +| | | | Variable [scan0] +| | | Evaluation [{proj0}] +| | | | FunctionCall [getField] +| | | | | Const ["a"] +| | | | Variable [scan0] | | | PhysicalScan [{'<root>': scan0}, collName] -| | | BindBlock: -| | | [scan0] -| | | Source [] -| | Evaluation [] -| | | BindBlock: -| | | [proj1] -| | | FunctionCall [getField] -| | | | Const ["b"] -| | | Variable [scan0] -| | Evaluation [] -| | | BindBlock: -| | | [proj0] -| | | FunctionCall [getField] -| | | | Const ["a"] -| | | Variable [scan0] +| | Evaluation [{proj1}] +| | | FunctionCall [getField] +| | | | Const ["b"] +| | | Variable [scan0] +| | Evaluation [{proj0}] +| | | FunctionCall [getField] +| | | | Const ["a"] +| | | Variable [scan0] | | PhysicalScan [{'<root>': scan0}, collName] -| | BindBlock: -| | [scan0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [15] smerge [s16] [asc] [ @@ -197,27 +132,15 @@ SortedMerge [] | | collation: | | proj0: Ascending | | proj1: Ascending -| BindBlock: -| [proj0] -| Source [] -| [proj1] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [3] smerge [s4, s5] [asc, asc] [ @@ -232,43 +155,24 @@ SortedMerge [] | | | collation: | | | proj0: Ascending | | | proj1: Ascending -| | BindBlock: -| | [proj0] -| | Source [] -| | [proj1] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] smerge [s7, s8] [asc, asc] [ @@ -286,91 +190,51 @@ SortedMerge [] | | | | | | collation: | | | | | | proj0: Ascending | | | | | | proj1: Ascending -| | | | | BindBlock: -| | | | | [proj0] -| | | | | Source [] -| | | | | [proj1] -| | | | | Source [] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj1] -| | | | | FunctionCall [getField] -| | | | | | Const ["b"] -| | | | | Variable [scan0] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj0] -| | | | | FunctionCall [getField] -| | | | | | Const ["a"] -| | | | | Variable [scan0] +| | | | Evaluation [{proj1}] +| | | | | FunctionCall [getField] +| | | | | | Const ["b"] +| | | | | Variable [scan0] +| | | | Evaluation [{proj0}] +| | | | | FunctionCall [getField] +| | | | | | Const ["a"] +| | | | | Variable [scan0] | | | | PhysicalScan [{'<root>': scan0}, collName] -| | | | BindBlock: -| | | | [scan0] -| | | | Source [] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj1] -| | | | FunctionCall [getField] -| | | | | Const ["b"] -| | | | Variable [scan0] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj0] -| | | | FunctionCall [getField] -| | | | | Const ["a"] -| | | | Variable [scan0] +| | | Evaluation [{proj1}] +| | | | FunctionCall [getField] +| | | | | Const ["b"] +| | | | Variable [scan0] +| | | Evaluation [{proj0}] +| | | | FunctionCall [getField] +| | | | | Const ["a"] +| | | | Variable [scan0] | | | PhysicalScan [{'<root>': scan0}, collName] -| | | BindBlock: -| | | [scan0] -| | | Source [] -| | Evaluation [] -| | | BindBlock: -| | | [proj1] -| | | FunctionCall [getField] -| | | | Const ["b"] -| | | Variable [scan0] -| | Evaluation [] -| | | BindBlock: -| | | [proj0] -| | | FunctionCall [getField] -| | | | Const ["a"] -| | | Variable [scan0] +| | Evaluation [{proj1}] +| | | FunctionCall [getField] +| | | | Const ["b"] +| | | Variable [scan0] +| | Evaluation [{proj0}] +| | | FunctionCall [getField] +| | | | Const ["a"] +| | | Variable [scan0] | | PhysicalScan [{'<root>': scan0}, collName] -| | BindBlock: -| | [scan0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [15] smerge [s16, s17] [asc, asc] [ @@ -397,27 +261,15 @@ SortedMerge [] | | collation: | | proj0: Ascending | | proj1: Descending -| BindBlock: -| [proj0] -| Source [] -| [proj1] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [3] smerge [s4, s5] [asc, desc] [ @@ -432,43 +284,24 @@ SortedMerge [] | | | collation: | | | proj0: Ascending | | | proj1: Descending -| | BindBlock: -| | [proj0] -| | Source [] -| | [proj1] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] smerge [s7, s8] [asc, desc] [ @@ -486,91 +319,51 @@ SortedMerge [] | | | | | | collation: | | | | | | proj0: Ascending | | | | | | proj1: Descending -| | | | | BindBlock: -| | | | | [proj0] -| | | | | Source [] -| | | | | [proj1] -| | | | | Source [] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj1] -| | | | | FunctionCall [getField] -| | | | | | Const ["b"] -| | | | | Variable [scan0] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj0] -| | | | | FunctionCall [getField] -| | | | | | Const ["a"] -| | | | | Variable [scan0] +| | | | Evaluation [{proj1}] +| | | | | FunctionCall [getField] +| | | | | | Const ["b"] +| | | | | Variable [scan0] +| | | | Evaluation [{proj0}] +| | | | | FunctionCall [getField] +| | | | | | Const ["a"] +| | | | | Variable [scan0] | | | | PhysicalScan [{'<root>': scan0}, collName] -| | | | BindBlock: -| | | | [scan0] -| | | | Source [] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj1] -| | | | FunctionCall [getField] -| | | | | Const ["b"] -| | | | Variable [scan0] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj0] -| | | | FunctionCall [getField] -| | | | | Const ["a"] -| | | | Variable [scan0] +| | | Evaluation [{proj1}] +| | | | FunctionCall [getField] +| | | | | Const ["b"] +| | | | Variable [scan0] +| | | Evaluation [{proj0}] +| | | | FunctionCall [getField] +| | | | | Const ["a"] +| | | | Variable [scan0] | | | PhysicalScan [{'<root>': scan0}, collName] -| | | BindBlock: -| | | [scan0] -| | | Source [] -| | Evaluation [] -| | | BindBlock: -| | | [proj1] -| | | FunctionCall [getField] -| | | | Const ["b"] -| | | Variable [scan0] -| | Evaluation [] -| | | BindBlock: -| | | [proj0] -| | | FunctionCall [getField] -| | | | Const ["a"] -| | | Variable [scan0] +| | Evaluation [{proj1}] +| | | FunctionCall [getField] +| | | | Const ["b"] +| | | Variable [scan0] +| | Evaluation [{proj0}] +| | | FunctionCall [getField] +| | | | Const ["a"] +| | | Variable [scan0] | | PhysicalScan [{'<root>': scan0}, collName] -| | BindBlock: -| | [scan0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [15] smerge [s16, s17] [asc, desc] [ @@ -596,25 +389,15 @@ PhysicalScan [{'<root>': scan0}, collName] SortedMerge [] | | collation: | | proj0: Descending -| BindBlock: -| [proj0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [3] smerge [s4] [desc] [ @@ -628,41 +411,24 @@ PhysicalScan [{'<root>': scan0}, collName] SortedMerge [] | | | collation: | | | proj0: Descending -| | BindBlock: -| | [proj0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] smerge [s7] [desc] [ @@ -679,89 +445,51 @@ PhysicalScan [{'<root>': scan0}, collName] SortedMerge [] | | | | | | collation: | | | | | | proj0: Descending -| | | | | BindBlock: -| | | | | [proj0] -| | | | | Source [] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj1] -| | | | | FunctionCall [getField] -| | | | | | Const ["b"] -| | | | | Variable [scan0] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj0] -| | | | | FunctionCall [getField] -| | | | | | Const ["a"] -| | | | | Variable [scan0] +| | | | Evaluation [{proj1}] +| | | | | FunctionCall [getField] +| | | | | | Const ["b"] +| | | | | Variable [scan0] +| | | | Evaluation [{proj0}] +| | | | | FunctionCall [getField] +| | | | | | Const ["a"] +| | | | | Variable [scan0] | | | | PhysicalScan [{'<root>': scan0}, collName] -| | | | BindBlock: -| | | | [scan0] -| | | | Source [] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj1] -| | | | FunctionCall [getField] -| | | | | Const ["b"] -| | | | Variable [scan0] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj0] -| | | | FunctionCall [getField] -| | | | | Const ["a"] -| | | | Variable [scan0] +| | | Evaluation [{proj1}] +| | | | FunctionCall [getField] +| | | | | Const ["b"] +| | | | Variable [scan0] +| | | Evaluation [{proj0}] +| | | | FunctionCall [getField] +| | | | | Const ["a"] +| | | | Variable [scan0] | | | PhysicalScan [{'<root>': scan0}, collName] -| | | BindBlock: -| | | [scan0] -| | | Source [] -| | Evaluation [] -| | | BindBlock: -| | | [proj1] -| | | FunctionCall [getField] -| | | | Const ["b"] -| | | Variable [scan0] -| | Evaluation [] -| | | BindBlock: -| | | [proj0] -| | | FunctionCall [getField] -| | | | Const ["a"] -| | | Variable [scan0] +| | Evaluation [{proj1}] +| | | FunctionCall [getField] +| | | | Const ["b"] +| | | Variable [scan0] +| | Evaluation [{proj0}] +| | | FunctionCall [getField] +| | | | Const ["a"] +| | | Variable [scan0] | | PhysicalScan [{'<root>': scan0}, collName] -| | BindBlock: -| | [scan0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [15] smerge [s16] [desc] [ @@ -788,27 +516,15 @@ SortedMerge [] | | collation: | | proj0: Descending | | proj1: Ascending -| BindBlock: -| [proj0] -| Source [] -| [proj1] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [3] smerge [s4, s5] [desc, asc] [ @@ -823,43 +539,24 @@ SortedMerge [] | | | collation: | | | proj0: Descending | | | proj1: Ascending -| | BindBlock: -| | [proj0] -| | Source [] -| | [proj1] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] smerge [s7, s8] [desc, asc] [ @@ -877,91 +574,51 @@ SortedMerge [] | | | | | | collation: | | | | | | proj0: Descending | | | | | | proj1: Ascending -| | | | | BindBlock: -| | | | | [proj0] -| | | | | Source [] -| | | | | [proj1] -| | | | | Source [] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj1] -| | | | | FunctionCall [getField] -| | | | | | Const ["b"] -| | | | | Variable [scan0] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj0] -| | | | | FunctionCall [getField] -| | | | | | Const ["a"] -| | | | | Variable [scan0] +| | | | Evaluation [{proj1}] +| | | | | FunctionCall [getField] +| | | | | | Const ["b"] +| | | | | Variable [scan0] +| | | | Evaluation [{proj0}] +| | | | | FunctionCall [getField] +| | | | | | Const ["a"] +| | | | | Variable [scan0] | | | | PhysicalScan [{'<root>': scan0}, collName] -| | | | BindBlock: -| | | | [scan0] -| | | | Source [] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj1] -| | | | FunctionCall [getField] -| | | | | Const ["b"] -| | | | Variable [scan0] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj0] -| | | | FunctionCall [getField] -| | | | | Const ["a"] -| | | | Variable [scan0] +| | | Evaluation [{proj1}] +| | | | FunctionCall [getField] +| | | | | Const ["b"] +| | | | Variable [scan0] +| | | Evaluation [{proj0}] +| | | | FunctionCall [getField] +| | | | | Const ["a"] +| | | | Variable [scan0] | | | PhysicalScan [{'<root>': scan0}, collName] -| | | BindBlock: -| | | [scan0] -| | | Source [] -| | Evaluation [] -| | | BindBlock: -| | | [proj1] -| | | FunctionCall [getField] -| | | | Const ["b"] -| | | Variable [scan0] -| | Evaluation [] -| | | BindBlock: -| | | [proj0] -| | | FunctionCall [getField] -| | | | Const ["a"] -| | | Variable [scan0] +| | Evaluation [{proj1}] +| | | FunctionCall [getField] +| | | | Const ["b"] +| | | Variable [scan0] +| | Evaluation [{proj0}] +| | | FunctionCall [getField] +| | | | Const ["a"] +| | | Variable [scan0] | | PhysicalScan [{'<root>': scan0}, collName] -| | BindBlock: -| | [scan0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [15] smerge [s16, s17] [desc, asc] [ @@ -988,27 +645,15 @@ SortedMerge [] | | collation: | | proj0: Descending | | proj1: Descending -| BindBlock: -| [proj0] -| Source [] -| [proj1] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [3] smerge [s4, s5] [desc, desc] [ @@ -1023,43 +668,24 @@ SortedMerge [] | | | collation: | | | proj0: Descending | | | proj1: Descending -| | BindBlock: -| | [proj0] -| | Source [] -| | [proj1] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] smerge [s7, s8] [desc, desc] [ @@ -1077,91 +703,51 @@ SortedMerge [] | | | | | | collation: | | | | | | proj0: Descending | | | | | | proj1: Descending -| | | | | BindBlock: -| | | | | [proj0] -| | | | | Source [] -| | | | | [proj1] -| | | | | Source [] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj1] -| | | | | FunctionCall [getField] -| | | | | | Const ["b"] -| | | | | Variable [scan0] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj0] -| | | | | FunctionCall [getField] -| | | | | | Const ["a"] -| | | | | Variable [scan0] +| | | | Evaluation [{proj1}] +| | | | | FunctionCall [getField] +| | | | | | Const ["b"] +| | | | | Variable [scan0] +| | | | Evaluation [{proj0}] +| | | | | FunctionCall [getField] +| | | | | | Const ["a"] +| | | | | Variable [scan0] | | | | PhysicalScan [{'<root>': scan0}, collName] -| | | | BindBlock: -| | | | [scan0] -| | | | Source [] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj1] -| | | | FunctionCall [getField] -| | | | | Const ["b"] -| | | | Variable [scan0] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj0] -| | | | FunctionCall [getField] -| | | | | Const ["a"] -| | | | Variable [scan0] +| | | Evaluation [{proj1}] +| | | | FunctionCall [getField] +| | | | | Const ["b"] +| | | | Variable [scan0] +| | | Evaluation [{proj0}] +| | | | FunctionCall [getField] +| | | | | Const ["a"] +| | | | Variable [scan0] | | | PhysicalScan [{'<root>': scan0}, collName] -| | | BindBlock: -| | | [scan0] -| | | Source [] -| | Evaluation [] -| | | BindBlock: -| | | [proj1] -| | | FunctionCall [getField] -| | | | Const ["b"] -| | | Variable [scan0] -| | Evaluation [] -| | | BindBlock: -| | | [proj0] -| | | FunctionCall [getField] -| | | | Const ["a"] -| | | Variable [scan0] +| | Evaluation [{proj1}] +| | | FunctionCall [getField] +| | | | Const ["b"] +| | | Variable [scan0] +| | Evaluation [{proj0}] +| | | FunctionCall [getField] +| | | | Const ["a"] +| | | Variable [scan0] | | PhysicalScan [{'<root>': scan0}, collName] -| | BindBlock: -| | [scan0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [proj1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{proj1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [15] smerge [s16, s17] [desc, desc] [ diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_spool_nodes.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_spool_nodes.txt index b628a185dd7..97565bc3e91 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_spool_nodes.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_spool_nodes.txt @@ -2,29 +2,15 @@ ==== VARIATION: Spool in union with Eager producer and Regular consumer ==== -- INPUT: -Union [] -| | BindBlock: -| | [proj0] -| | Source [] -| SpoolConsumer [Regular, id: 1] -| BindBlock: -| [proj0] -| Source [] -SpoolProducer [Eager, id: 1] +Union [{proj0}] +| SpoolConsumer [Regular, id: 1, {proj0}] +SpoolProducer [Eager, id: 1, {proj0}] | | Const [true] -| BindBlock: -| [proj0] -| Source [] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] union [s4] @@ -38,29 +24,15 @@ PhysicalScan [{'<root>': scan0}, collName] ==== VARIATION: Spool in union with Eager producer and Stack consumer ==== -- INPUT: -Union [] -| | BindBlock: -| | [proj0] -| | Source [] -| SpoolConsumer [Stack, id: 1] -| BindBlock: -| [proj0] -| Source [] -SpoolProducer [Eager, id: 1] +Union [{proj0}] +| SpoolConsumer [Stack, id: 1, {proj0}] +SpoolProducer [Eager, id: 1, {proj0}] | | Const [true] -| BindBlock: -| [proj0] -| Source [] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] union [s4] @@ -74,29 +46,15 @@ PhysicalScan [{'<root>': scan0}, collName] ==== VARIATION: Spool in union with Lazy producer and Regular consumer ==== -- INPUT: -Union [] -| | BindBlock: -| | [proj0] -| | Source [] -| SpoolConsumer [Regular, id: 1] -| BindBlock: -| [proj0] -| Source [] -SpoolProducer [Lazy, id: 1] +Union [{proj0}] +| SpoolConsumer [Regular, id: 1, {proj0}] +SpoolProducer [Lazy, id: 1, {proj0}] | | Const [true] -| BindBlock: -| [proj0] -| Source [] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] union [s4] @@ -110,29 +68,15 @@ PhysicalScan [{'<root>': scan0}, collName] ==== VARIATION: Spool in union with Lazy producer and Stack consumer ==== -- INPUT: -Union [] -| | BindBlock: -| | [proj0] -| | Source [] -| SpoolConsumer [Stack, id: 1] -| BindBlock: -| [proj0] -| Source [] -SpoolProducer [Lazy, id: 1] +Union [{proj0}] +| SpoolConsumer [Stack, id: 1, {proj0}] +SpoolProducer [Lazy, id: 1, {proj0}] | | Const [true] -| BindBlock: -| [proj0] -| Source [] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] union [s4] @@ -146,15 +90,9 @@ PhysicalScan [{'<root>': scan0}, collName] ==== VARIATION: Spool in union with filter expression ==== -- INPUT: -Union [] -| | BindBlock: -| | [proj0] -| | Source [] -| SpoolConsumer [Stack, id: 1] -| BindBlock: -| [proj0] -| Source [] -SpoolProducer [Lazy, id: 1] +Union [{proj0}] +| SpoolConsumer [Stack, id: 1, {proj0}] +SpoolProducer [Lazy, id: 1, {proj0}] | | BinaryOp [FillEmpty] | | | Const [false] | | BinaryOp [Gte] @@ -164,19 +102,11 @@ SpoolProducer [Lazy, id: 1] | | FunctionCall [getField] | | | Const ["b"] | | Variable [scan0] -| BindBlock: -| [proj0] -| Source [] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] union [s4] diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_union_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_union_node.txt index e04bd6818c9..2c94235a20e 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_union_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_union_node.txt @@ -2,26 +2,16 @@ ==== VARIATION: UnionNode with only one child ==== -- INPUT: -Union [] -| BindBlock: -| [proj0] -| Source [] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Union [{proj0}] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [2] project [s3 = getField(s1, "b")] @@ -30,42 +20,25 @@ PhysicalScan [{'<root>': scan0}, collName] ==== VARIATION: UnionNode with two children ==== -- INPUT: -Union [] -| | BindBlock: -| | [proj0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [right1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +Union [{proj0}] +| Evaluation [{right1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [left1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{left1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [6] union [s7] @@ -81,90 +54,52 @@ PhysicalScan [{'<root>': scan0}, collName] ==== VARIATION: UnionNode with many children ==== -- INPUT: -Union [] -| | | | | BindBlock: -| | | | | [proj0] -| | | | | Source [] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [e1] -| | | | | FunctionCall [getField] -| | | | | | Const ["b"] -| | | | | Variable [scan0] -| | | | Evaluation [] -| | | | | BindBlock: -| | | | | [proj0] -| | | | | FunctionCall [getField] -| | | | | | Const ["a"] -| | | | | Variable [scan0] +Union [{proj0}] +| | | | Evaluation [{e1}] +| | | | | FunctionCall [getField] +| | | | | | Const ["b"] +| | | | | Variable [scan0] +| | | | Evaluation [{proj0}] +| | | | | FunctionCall [getField] +| | | | | | Const ["a"] +| | | | | Variable [scan0] | | | | PhysicalScan [{'<root>': scan0}, collName] -| | | | BindBlock: -| | | | [scan0] -| | | | Source [] -| | | Evaluation [] -| | | | BindBlock: -| | | | [d1] -| | | | FunctionCall [getField] -| | | | | Const ["b"] -| | | | Variable [scan0] -| | | Evaluation [] -| | | | BindBlock: -| | | | [proj0] -| | | | FunctionCall [getField] -| | | | | Const ["a"] -| | | | Variable [scan0] +| | | Evaluation [{d1}] +| | | | FunctionCall [getField] +| | | | | Const ["b"] +| | | | Variable [scan0] +| | | Evaluation [{proj0}] +| | | | FunctionCall [getField] +| | | | | Const ["a"] +| | | | Variable [scan0] | | | PhysicalScan [{'<root>': scan0}, collName] -| | | BindBlock: -| | | [scan0] -| | | Source [] -| | Evaluation [] -| | | BindBlock: -| | | [c1] -| | | FunctionCall [getField] -| | | | Const ["b"] -| | | Variable [scan0] -| | Evaluation [] -| | | BindBlock: -| | | [proj0] -| | | FunctionCall [getField] -| | | | Const ["a"] -| | | Variable [scan0] +| | Evaluation [{c1}] +| | | FunctionCall [getField] +| | | | Const ["b"] +| | | Variable [scan0] +| | Evaluation [{proj0}] +| | | FunctionCall [getField] +| | | | Const ["a"] +| | | Variable [scan0] | | PhysicalScan [{'<root>': scan0}, collName] -| | BindBlock: -| | [scan0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [b1] -| | FunctionCall [getField] -| | | Const ["b"] -| | Variable [scan0] -| Evaluation [] -| | BindBlock: -| | [proj0] -| | FunctionCall [getField] -| | | Const ["a"] -| | Variable [scan0] +| Evaluation [{b1}] +| | FunctionCall [getField] +| | | Const ["b"] +| | Variable [scan0] +| Evaluation [{proj0}] +| | FunctionCall [getField] +| | | Const ["a"] +| | Variable [scan0] | PhysicalScan [{'<root>': scan0}, collName] -| BindBlock: -| [scan0] -| Source [] -Evaluation [] -| BindBlock: -| [a1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{a1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [15] union [s16] diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_unique_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_unique_node.txt index 5bef954dccc..3c3fadd9460 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_unique_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_unique_node.txt @@ -5,16 +5,11 @@ Unique [] | projections: | proj0 -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [2] unique [s2] @@ -28,28 +23,19 @@ Unique [] | proj0 | proj1 | proj2 -Evaluation [] -| BindBlock: -| [proj2] -| FunctionCall [getField] -| | Const ["c"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj1] -| FunctionCall [getField] -| | Const ["b"] -| Variable [scan0] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj2}] +| FunctionCall [getField] +| | Const ["c"] +| Variable [scan0] +Evaluation [{proj1}] +| FunctionCall [getField] +| | Const ["b"] +| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [4] unique [s2, s3, s4] diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_unwind_node.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_unwind_node.txt index 7250ef5ea1c..3186bc9c071 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_unwind_node.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_unwind_node.txt @@ -3,21 +3,11 @@ ==== VARIATION: Lower UnwindNode discard non-arrays ==== -- INPUT: Unwind [] -| BindBlock: -| [proj0] -| Source [] -| [proj0_pid] -| Source [] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [2] unwind s3 s4 s2 false @@ -27,21 +17,11 @@ PhysicalScan [{'<root>': scan0}, collName] ==== VARIATION: Lower UnwindNode keep non-arrays ==== -- INPUT: Unwind [retainNonArrays] -| BindBlock: -| [proj0] -| Source [] -| [proj0_pid] -| Source [] -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [2] unwind s3 s4 s2 true diff --git a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_var_expression.txt b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_var_expression.txt index 360f914d26f..375f485c591 100644 --- a/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_var_expression.txt +++ b/src/mongo/db/test_output/exec/sbe/a_b_t_plan_generation/lower_var_expression.txt @@ -2,16 +2,11 @@ ==== VARIATION: varInProj ==== -- INPUT: -Evaluation [] -| BindBlock: -| [proj0] -| FunctionCall [getField] -| | Const ["a"] -| Variable [scan0] +Evaluation [{proj0}] +| FunctionCall [getField] +| | Const ["a"] +| Variable [scan0] PhysicalScan [{'<root>': scan0}, collName] - BindBlock: - [scan0] - Source [] -- OUTPUT: [1] project [s2 = getField(s1, "a")] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_optimization_test/optimize_pipeline_tests.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_optimization_test/optimize_pipeline_tests.txt index bb98a527a56..8f2dd57ff17 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_optimization_test/optimize_pipeline_tests.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_optimization_test/optimize_pipeline_tests.txt @@ -38,21 +38,15 @@ Root [] | RefBlock: | Variable [scan_0] Sargable [Complete] -| | | | | requirementsMap: -| | | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] PathIdentity []', intervals: {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}} -| | | | candidateIndexes: -| | | | candidateId: 1, index1, {}, {Compound}, {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}} -| | | scanParams: -| | | {'a': evalTemp_0} -| | | residualReqs: -| | | refProjection: evalTemp_0, path: 'PathTraverse [1] PathIdentity []', intervals: {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}}, entryIndex: 0 -| | BindBlock: -| RefBlock: -| Variable [scan_0] -Scan [collection] - BindBlock: - [scan_0] - Source [] +| | | | requirementsMap: +| | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] PathIdentity []', intervals: {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}} +| | | candidateIndexes: +| | | candidateId: 1, index1, {}, {Compound}, {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}} +| | scanParams: +| | {'a': evalTemp_0} +| | residualReqs: +| | refProjection: evalTemp_0, path: 'PathTraverse [1] PathIdentity []', intervals: {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}}, entryIndex: 0 +Scan [collection, {scan_0}] ==== VARIATION: optimized $match with $in and a list of equalities becomes a comparison to an EqMember list. ==== @@ -95,21 +89,15 @@ Root [] | RefBlock: | Variable [scan_0] Sargable [Complete] -| | | | | requirementsMap: -| | | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] PathIdentity []', intervals: {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}} -| | | | candidateIndexes: -| | | | candidateId: 1, index1, {}, {Compound}, {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}} -| | | scanParams: -| | | {'a': evalTemp_0} -| | | residualReqs: -| | | refProjection: evalTemp_0, path: 'PathTraverse [1] PathIdentity []', intervals: {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}}, entryIndex: 0 -| | BindBlock: -| RefBlock: -| Variable [scan_0] -Scan [collection] - BindBlock: - [scan_0] - Source [] +| | | | requirementsMap: +| | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] PathIdentity []', intervals: {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}} +| | | candidateIndexes: +| | | candidateId: 1, index1, {}, {Compound}, {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}} +| | scanParams: +| | {'a': evalTemp_0} +| | residualReqs: +| | refProjection: evalTemp_0, path: 'PathTraverse [1] PathIdentity []', intervals: {{{=Const [1]}} U {{=Const [2]}} U {{=Const [3]}}}, entryIndex: 0 +Scan [collection, {scan_0}] ==== VARIATION: optimized $project inclusion then $match: observe the Filter can be reordered against the Eval node ==== @@ -139,22 +127,20 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Const [{}] -| PathComposeM [] -| | PathField [b] -| | PathConstant [] -| | Variable [fieldProj_2] -| PathComposeM [] -| | PathField [a] -| | PathConstant [] -| | Variable [fieldProj_1] -| PathField [_id] -| PathConstant [] -| Variable [fieldProj_0] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Const [{}] +| PathComposeM [] +| | PathField [b] +| | PathConstant [] +| | Variable [fieldProj_2] +| PathComposeM [] +| | PathField [a] +| | PathConstant [] +| | Variable [fieldProj_1] +| PathField [_id] +| PathConstant [] +| Variable [fieldProj_0] Filter [] | EvalFilter [] | | Variable [fieldProj_1] @@ -162,13 +148,6 @@ Filter [] | PathCompare [Eq] | Const [2] PhysicalScan [{'_id': fieldProj_0, 'a': fieldProj_1, 'b': fieldProj_2}, collection] - BindBlock: - [fieldProj_0] - Source [] - [fieldProj_1] - Source [] - [fieldProj_2] - Source [] ==== VARIATION: optimized $match basic ==== @@ -209,13 +188,6 @@ Filter [] | PathCompare [Eq] | Const [1] PhysicalScan [{'<root>': scan_0, 'a': evalTemp_2, 'b': evalTemp_3}, collection] - BindBlock: - [evalTemp_2] - Source [] - [evalTemp_3] - Source [] - [scan_0] - Source [] ==== VARIATION: optimized $expr filter: make sure we have a single array constant for (1, 2, 'str', ...) ==== @@ -241,37 +213,32 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathComposeM [] -| | PathDefault [] -| | Const [{}] -| PathComposeM [] -| | PathField [a] -| | PathConstant [] -| | EvalPath [] -| | | Const [[1, 2, "str", {"a" : 2, "b" : "s"}, 3, 4]] -| | PathTraverse [inf] -| | PathLambda [] -| | LambdaAbstraction [var_1] -| | If [] -| | | | Const [Nothing] -| | | Variable [var_1] -| | BinaryOp [And] -| | | BinaryOp [Gte] -| | | | Const [2] -| | | Variable [var_1] -| | BinaryOp [Lte] -| | | Const [3] -| | Variable [var_1] -| PathKeep [_id, a] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathComposeM [] +| | PathField [a] +| | PathConstant [] +| | EvalPath [] +| | | Const [[1, 2, "str", {"a" : 2, "b" : "s"}, 3, 4]] +| | PathTraverse [inf] +| | PathLambda [] +| | LambdaAbstraction [var_1] +| | If [] +| | | | Const [Nothing] +| | | Variable [var_1] +| | BinaryOp [And] +| | | BinaryOp [Gte] +| | | | Const [2] +| | | Variable [var_1] +| | BinaryOp [Lte] +| | | Const [3] +| | Variable [var_1] +| PathKeep [_id, a] +Scan [collection, {scan_0}] ==== VARIATION: optimized $group local global ==== @@ -303,18 +270,16 @@ Exchange [] | | distribution: | | type: Centralized | RefBlock: -Evaluation [] -| BindBlock: -| [agg_project_0] -| EvalPath [] -| | Const [{}] -| PathComposeM [] -| | PathField [c] -| | PathConstant [] -| | Variable [field_agg_0] -| PathField [_id] -| PathConstant [] -| Variable [groupByProj_0] +Evaluation [{agg_project_0}] +| EvalPath [] +| | Const [{}] +| PathComposeM [] +| | PathField [c] +| | PathConstant [] +| | Variable [field_agg_0] +| PathField [_id] +| PathConstant [] +| Variable [groupByProj_0] GroupBy [Global] | | groupings: | | RefBlock: @@ -339,11 +304,6 @@ GroupBy [Local] | FunctionCall [$sum] | Variable [groupByInputProj_0] PhysicalScan [{'a': groupByProj_0, 'b': groupByInputProj_0}, collection, parallel] - BindBlock: - [groupByInputProj_0] - Source [] - [groupByProj_0] - Source [] ==== VARIATION: optimized $unwind then $sort ==== @@ -380,36 +340,22 @@ Collation [] | | sort_0: Ascending | RefBlock: | Variable [sort_0] -Evaluation [] -| BindBlock: -| [sort_0] -| Variable [unwoundProj_0] -Evaluation [] -| BindBlock: -| [embedProj_0] -| If [] -| | | Variable [scan_0] -| | FunctionCall [setField] -| | | | Variable [unwoundProj_0] -| | | Const ["x"] -| | Variable [scan_0] -| BinaryOp [Or] -| | FunctionCall [isObject] -| | Variable [scan_0] -| FunctionCall [exists] -| Variable [unwoundProj_0] +Evaluation [{sort_0}] +| Variable [unwoundProj_0] +Evaluation [{embedProj_0}] +| If [] +| | | Variable [scan_0] +| | FunctionCall [setField] +| | | | Variable [unwoundProj_0] +| | | Const ["x"] +| | Variable [scan_0] +| BinaryOp [Or] +| | FunctionCall [isObject] +| | Variable [scan_0] +| FunctionCall [exists] +| Variable [unwoundProj_0] Unwind [] -| BindBlock: -| [unwoundPid_0] -| Source [] -| [unwoundProj_0] -| Source [] PhysicalScan [{'<root>': scan_0, 'x': unwoundProj_0}, collection] - BindBlock: - [scan_0] - Source [] - [unwoundProj_0] - Source [] ==== VARIATION: optimized $match with index ==== @@ -460,15 +406,9 @@ NestedLoopJoin [joinType: Inner, {rid_0}] | | limit: 1 | | skip: 0 | Seek [ridProjection: rid_0, {'<root>': scan_0}, collection] -| | BindBlock: -| | [scan_0] -| | Source [] | RefBlock: | Variable [rid_0] IndexScan [{'<rid>': rid_0}, scanDefName: collection, indexDefName: index1, interval: {=Const [10]}] - BindBlock: - [rid_0] - Source [] ==== VARIATION: optimized $match index covered ==== @@ -513,18 +453,13 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Const [{}] -| PathField [a] -| PathConstant [] -| Variable [fieldProj_0] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Const [{}] +| PathField [a] +| PathConstant [] +| Variable [fieldProj_0] IndexScan [{'<indexKey> 0': fieldProj_0}, scanDefName: collection, indexDefName: index1, interval: {=Const [10]}] - BindBlock: - [fieldProj_0] - Source [] ==== VARIATION: optimized $match index covered, match then project ==== @@ -569,18 +504,13 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Const [{}] -| PathField [a] -| PathConstant [] -| Variable [fieldProj_0] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Const [{}] +| PathField [a] +| PathConstant [] +| Variable [fieldProj_0] IndexScan [{'<indexKey> 0': fieldProj_0}, scanDefName: collection, indexDefName: index1, interval: {=Const [10]}] - BindBlock: - [fieldProj_0] - Source [] ==== VARIATION: optimized $match index covered, match on two indexed keys then project ==== @@ -630,18 +560,13 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Const [{}] -| PathField [a] -| PathConstant [] -| Variable [fieldProj_0] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Const [{}] +| PathField [a] +| PathConstant [] +| Variable [fieldProj_0] IndexScan [{'<indexKey> 0': fieldProj_0}, scanDefName: collection, indexDefName: index1, interval: {=Const [10], =Const [20]}] - BindBlock: - [fieldProj_0] - Source [] ==== VARIATION: optimized $match index covered, match on three indexed keys then project ==== @@ -696,30 +621,21 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Const [{}] -| PathComposeM [] -| | PathField [c] -| | PathConstant [] -| | Variable [fieldProj_2] -| PathComposeM [] -| | PathField [b] -| | PathConstant [] -| | Variable [fieldProj_1] -| PathField [a] -| PathConstant [] -| Variable [fieldProj_0] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Const [{}] +| PathComposeM [] +| | PathField [c] +| | PathConstant [] +| | Variable [fieldProj_2] +| PathComposeM [] +| | PathField [b] +| | PathConstant [] +| | Variable [fieldProj_1] +| PathField [a] +| PathConstant [] +| Variable [fieldProj_0] IndexScan [{'<indexKey> 0': fieldProj_0, '<indexKey> 1': fieldProj_1, '<indexKey> 2': fieldProj_2}, scanDefName: collection, indexDefName: index1, interval: {=Const [10], =Const [20], =Const [30]}] - BindBlock: - [fieldProj_0] - Source [] - [fieldProj_1] - Source [] - [fieldProj_2] - Source [] ==== VARIATION: optimized $match index covered, inclusion project then match on three indexed keys ==== @@ -774,30 +690,21 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Const [{}] -| PathComposeM [] -| | PathField [c] -| | PathConstant [] -| | Variable [fieldProj_2] -| PathComposeM [] -| | PathField [b] -| | PathConstant [] -| | Variable [fieldProj_1] -| PathField [a] -| PathConstant [] -| Variable [fieldProj_0] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Const [{}] +| PathComposeM [] +| | PathField [c] +| | PathConstant [] +| | Variable [fieldProj_2] +| PathComposeM [] +| | PathField [b] +| | PathConstant [] +| | Variable [fieldProj_1] +| PathField [a] +| PathConstant [] +| Variable [fieldProj_0] IndexScan [{'<indexKey> 0': fieldProj_0, '<indexKey> 1': fieldProj_1, '<indexKey> 2': fieldProj_2}, scanDefName: collection, indexDefName: index1, interval: {=Const [10], =Const [20], =Const [30]}] - BindBlock: - [fieldProj_0] - Source [] - [fieldProj_1] - Source [] - [fieldProj_2] - Source [] ==== VARIATION: optimized $match sort index ==== @@ -853,17 +760,9 @@ NestedLoopJoin [joinType: Inner, {rid_0}] | | limit: 1 | | skip: 0 | Seek [ridProjection: rid_0, {'<root>': scan_0, 'a': sort_0}, collection] -| | BindBlock: -| | [scan_0] -| | Source [] -| | [sort_0] -| | Source [] | RefBlock: | Variable [rid_0] IndexScan [{'<rid>': rid_0}, scanDefName: collection, indexDefName: index1, interval: {=Const [10]}] - BindBlock: - [rid_0] - Source [] ==== VARIATION: optimized range index ==== @@ -914,9 +813,6 @@ NestedLoopJoin [joinType: Inner, {rid_0}] | | limit: 1 | | skip: 0 | Seek [ridProjection: rid_0, {'<root>': scan_0}, collection] -| | BindBlock: -| | [scan_0] -| | Source [] | RefBlock: | Variable [rid_0] Filter [] @@ -933,28 +829,13 @@ GroupBy [] | [sides_0] | FunctionCall [$addToSet] | Variable [sideId_0] -Union [] -| | BindBlock: -| | [rid_0] -| | Source [] -| | [sideId_0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [sideId_0] -| | Const [1] +Union [{rid_0, sideId_0}] +| Evaluation [{sideId_0}] +| | Const [1] | IndexScan [{'<rid>': rid_0}, scanDefName: collection, indexDefName: index1, interval: {(Const [70], Const [""])}] -| BindBlock: -| [rid_0] -| Source [] -Evaluation [] -| BindBlock: -| [sideId_0] -| Const [0] +Evaluation [{sideId_0}] +| Const [0] IndexScan [{'<rid>': rid_0}, scanDefName: collection, indexDefName: index1, interval: {[Const [nan], Const [90])}] - BindBlock: - [rid_0] - Source [] ==== VARIATION: optimized index on two keys ==== @@ -1011,15 +892,9 @@ NestedLoopJoin [joinType: Inner, {rid_0}] | | limit: 1 | | skip: 0 | Seek [ridProjection: rid_0, {'<root>': scan_0}, collection] -| | BindBlock: -| | [scan_0] -| | Source [] | RefBlock: | Variable [rid_0] IndexScan [{'<rid>': rid_0}, scanDefName: collection, indexDefName: index1, interval: {=Const [2], =Const [2]}] - BindBlock: - [rid_0] - Source [] ==== VARIATION: optimized index on one key ==== @@ -1077,17 +952,9 @@ NestedLoopJoin [joinType: Inner, {rid_0}] | | limit: 1 | | skip: 0 | Seek [ridProjection: rid_0, {'<root>': scan_0, 'b': evalTemp_4}, collection] -| | BindBlock: -| | [evalTemp_4] -| | Source [] -| | [scan_0] -| | Source [] | RefBlock: | Variable [rid_0] IndexScan [{'<rid>': rid_0}, scanDefName: collection, indexDefName: index1, interval: {=Const [2]}] - BindBlock: - [rid_0] - Source [] ==== VARIATION: optimized $group eval no inline: verify that "b" is not inlined in the group expression, but is coming from the physical scan ==== @@ -1119,32 +986,30 @@ Root [] | | agg_project_0 | RefBlock: | Variable [agg_project_0] -Evaluation [] -| BindBlock: -| [agg_project_0] -| Let [inputField_1] -| | If [] -| | | | Variable [inputField_1] -| | | FunctionCall [setField] -| | | | | Variable [field_agg_0] -| | | | Const ["a"] -| | | Variable [inputField_1] -| | BinaryOp [Or] -| | | FunctionCall [isObject] -| | | Variable [inputField_1] -| | FunctionCall [exists] -| | Variable [field_agg_0] -| If [] -| | | Const [{}] -| | FunctionCall [setField] -| | | | Variable [groupByProj_0] -| | | Const ["_id"] -| | Const [{}] -| BinaryOp [Or] -| | FunctionCall [isObject] -| | Const [{}] -| FunctionCall [exists] -| Variable [groupByProj_0] +Evaluation [{agg_project_0}] +| Let [inputField_1] +| | If [] +| | | | Variable [inputField_1] +| | | FunctionCall [setField] +| | | | | Variable [field_agg_0] +| | | | Const ["a"] +| | | Variable [inputField_1] +| | BinaryOp [Or] +| | | FunctionCall [isObject] +| | | Variable [inputField_1] +| | FunctionCall [exists] +| | Variable [field_agg_0] +| If [] +| | | Const [{}] +| | FunctionCall [setField] +| | | | Variable [groupByProj_0] +| | | Const ["_id"] +| | Const [{}] +| BinaryOp [Or] +| | FunctionCall [isObject] +| | Const [{}] +| FunctionCall [exists] +| Variable [groupByProj_0] GroupBy [] | | groupings: | | RefBlock: @@ -1153,14 +1018,9 @@ GroupBy [] | [field_agg_0] | FunctionCall [$first] | Variable [groupByInputProj_0] -Evaluation [] -| BindBlock: -| [groupByProj_0] -| Const [null] +Evaluation [{groupByProj_0}] +| Const [null] PhysicalScan [{'b': groupByInputProj_0}, collection] - BindBlock: - [groupByInputProj_0] - Source [] ==== VARIATION: optimized union ==== @@ -1196,10 +1056,7 @@ Root [] | | scan_0 | RefBlock: | Variable [scan_0] -Union [] -| | BindBlock: -| | [scan_0] -| | Source [] +Union [{scan_0}] | Filter [] | | EvalFilter [] | | | Variable [scan_0] @@ -1207,16 +1064,11 @@ Union [] | | PathTraverse [1] | | PathCompare [Eq] | | Const [1] -| Evaluation [] -| | BindBlock: -| | [scan_0] -| | EvalPath [] -| | | Variable [scan_1] -| | PathIdentity [] +| Evaluation [{scan_0}] +| | EvalPath [] +| | | Variable [scan_1] +| | PathIdentity [] | PhysicalScan [{'<root>': scan_1}, collB] -| BindBlock: -| [scan_1] -| Source [] Filter [] | EvalFilter [] | | Variable [evalTemp_0] @@ -1224,11 +1076,6 @@ Filter [] | PathCompare [Eq] | Const [1] PhysicalScan [{'<root>': scan_0, '_id': evalTemp_0}, collA] - BindBlock: - [evalTemp_0] - Source [] - [scan_0] - Source [] ==== VARIATION: optimized common expression elimination ==== @@ -1254,36 +1101,29 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathComposeM [] -| | PathDefault [] -| | Const [{}] -| PathComposeM [] -| | PathField [foo] -| | PathConstant [] -| | Variable [projGetPath_0] -| PathComposeM [] -| | PathField [bar] -| | PathConstant [] -| | Variable [projGetPath_0] -| PathKeep [_id, bar, foo] -Evaluation [] -| BindBlock: -| [projGetPath_0] -| BinaryOp [Add] -| | Const [1] -| EvalPath [] -| | Variable [scan_0] -| PathGet [b] -| PathIdentity [] -Scan [test] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathComposeM [] +| | PathField [foo] +| | PathConstant [] +| | Variable [projGetPath_0] +| PathComposeM [] +| | PathField [bar] +| | PathConstant [] +| | Variable [projGetPath_0] +| PathKeep [_id, bar, foo] +Evaluation [{projGetPath_0}] +| BinaryOp [Add] +| | Const [1] +| EvalPath [] +| | Variable [scan_0] +| PathGet [b] +| PathIdentity [] +Scan [test, {scan_0}] ==== VARIATION: optimized group by dependency: demonstrate that "c" is set to the array size (not the array itself coming from the group) ==== @@ -1313,17 +1153,15 @@ Root [] | | combinedProjection_1 | RefBlock: | Variable [combinedProjection_1] -Evaluation [] -| BindBlock: -| [combinedProjection_1] -| EvalPath [] -| | Const [{}] -| PathComposeM [] -| | PathField [c] -| | PathConstant [] -| | FunctionCall [getArraySize] -| | Variable [field_agg_0] -| PathKeep [] +Evaluation [{combinedProjection_1}] +| EvalPath [] +| | Const [{}] +| PathComposeM [] +| | PathField [c] +| | PathConstant [] +| | FunctionCall [getArraySize] +| | Variable [field_agg_0] +| PathKeep [] GroupBy [] | | groupings: | | RefBlock: @@ -1332,14 +1170,9 @@ GroupBy [] | [field_agg_0] | FunctionCall [$addToSet] | Variable [groupByInputProj_0] -Evaluation [] -| BindBlock: -| [groupByProj_0] -| Const [{}] +Evaluation [{groupByProj_0}] +| Const [{}] PhysicalScan [{'a': groupByInputProj_0}, test] - BindBlock: - [groupByInputProj_0] - Source [] ==== VARIATION: optimized double $elemMatch ==== @@ -1366,25 +1199,19 @@ Root [] | RefBlock: | Variable [scan_0] Sargable [Complete] -| | | | | requirementsMap: -| | | | | refProjection: scan_0, path: 'PathGet [a] PathIdentity []', intervals: {{{[Const [[]], Const [BinData(0, )])}}} -| | | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] PathIdentity []', intervals: {{{[Const [5], Const [6]]}}} -| | | | | refProjection: scan_0, path: 'PathGet [b] PathIdentity []', intervals: {{{[Const [[]], Const [BinData(0, )])}}} -| | | | | refProjection: scan_0, path: 'PathGet [b] PathTraverse [1] PathIdentity []', intervals: {{{[Const [1], Const [3]]}}} -| | | | candidateIndexes: -| | | scanParams: -| | | {'a': evalTemp_7, 'b': evalTemp_8} -| | | residualReqs: -| | | refProjection: evalTemp_7, path: 'PathIdentity []', intervals: {{{[Const [[]], Const [BinData(0, )])}}}, entryIndex: 0 -| | | refProjection: evalTemp_7, path: 'PathTraverse [1] PathIdentity []', intervals: {{{[Const [5], Const [6]]}}}, entryIndex: 1 -| | | refProjection: evalTemp_8, path: 'PathIdentity []', intervals: {{{[Const [[]], Const [BinData(0, )])}}}, entryIndex: 2 -| | | refProjection: evalTemp_8, path: 'PathTraverse [1] PathIdentity []', intervals: {{{[Const [1], Const [3]]}}}, entryIndex: 3 -| | BindBlock: -| RefBlock: -| Variable [scan_0] -Scan [test] - BindBlock: - [scan_0] - Source [] +| | | | requirementsMap: +| | | | refProjection: scan_0, path: 'PathGet [a] PathIdentity []', intervals: {{{[Const [[]], Const [BinData(0, )])}}} +| | | | refProjection: scan_0, path: 'PathGet [a] PathTraverse [1] PathIdentity []', intervals: {{{[Const [5], Const [6]]}}} +| | | | refProjection: scan_0, path: 'PathGet [b] PathIdentity []', intervals: {{{[Const [[]], Const [BinData(0, )])}}} +| | | | refProjection: scan_0, path: 'PathGet [b] PathTraverse [1] PathIdentity []', intervals: {{{[Const [1], Const [3]]}}} +| | | candidateIndexes: +| | scanParams: +| | {'a': evalTemp_7, 'b': evalTemp_8} +| | residualReqs: +| | refProjection: evalTemp_7, path: 'PathIdentity []', intervals: {{{[Const [[]], Const [BinData(0, )])}}}, entryIndex: 0 +| | refProjection: evalTemp_7, path: 'PathTraverse [1] PathIdentity []', intervals: {{{[Const [5], Const [6]]}}}, entryIndex: 1 +| | refProjection: evalTemp_8, path: 'PathIdentity []', intervals: {{{[Const [[]], Const [BinData(0, )])}}}, entryIndex: 2 +| | refProjection: evalTemp_8, path: 'PathTraverse [1] PathIdentity []', intervals: {{{[Const [1], Const [3]]}}}, entryIndex: 3 +Scan [test, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_optimization_test/partial_index.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_optimization_test/partial_index.txt index edede907032..b17bc4c3353 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_optimization_test/partial_index.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_optimization_test/partial_index.txt @@ -61,17 +61,9 @@ NestedLoopJoin [joinType: Inner, {rid_0}] | | limit: 1 | | skip: 0 | Seek [ridProjection: rid_0, {'<root>': scan_0, 'b': evalTemp_4}, collection] -| | BindBlock: -| | [evalTemp_4] -| | Source [] -| | [scan_0] -| | Source [] | RefBlock: | Variable [rid_0] IndexScan [{'<rid>': rid_0}, scanDefName: collection, indexDefName: index1, interval: {=Const [3]}] - BindBlock: - [rid_0] - Source [] ==== VARIATION: optimized partial index negative: the expression does not match the pipeline ==== @@ -141,12 +133,5 @@ Filter [] | | Variable [valCmp_0] | Variable [evalTemp_2] PhysicalScan [{'<root>': scan_0, 'a': evalTemp_2, 'b': evalTemp_3}, collection] - BindBlock: - [evalTemp_2] - Source [] - [evalTemp_3] - Source [] - [scan_0] - Source [] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/and_or_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/and_or_translation.txt index 1d4a4005a6b..4a961ffad2e 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/and_or_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/and_or_translation.txt @@ -33,10 +33,7 @@ Filter [] | PathTraverse [1] | PathCompare [Eq] | Const [2] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match disjunction ==== @@ -72,10 +69,7 @@ Filter [] | PathTraverse [1] | PathCompare [Eq] | Const [2] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match nested conjunction ==== @@ -120,9 +114,6 @@ Filter [] | PathTraverse [1] | PathCompare [Eq] | Const [3] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/computed_projection_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/computed_projection_translation.txt index 631750bf3cc..4517b130bc7 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/computed_projection_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/computed_projection_translation.txt @@ -19,28 +19,21 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathComposeM [] -| | PathDefault [] -| | Const [{}] -| PathField [a] -| PathConstant [] -| Variable [projRenamedPath_0] -Evaluation [] -| BindBlock: -| [projRenamedPath_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [z] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathField [a] +| PathConstant [] +| Variable [projRenamedPath_0] +Evaluation [{projRenamedPath_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [z] +| PathIdentity [] +Scan [collection, {scan_0}] ==== VARIATION: project rename: since '$c' is a single element, it will be considered a renamed path ==== @@ -64,34 +57,27 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathComposeM [] -| | PathField [a] -| | PathTraverse [inf] -| | PathComposeM [] -| | | PathDefault [] -| | | Const [{}] -| | PathComposeM [] -| | | PathField [b] -| | | PathConstant [] -| | | Variable [projRenamedPath_0] -| | PathKeep [b] -| PathKeep [_id, a] -Evaluation [] -| BindBlock: -| [projRenamedPath_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [c] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathField [a] +| | PathTraverse [inf] +| | PathComposeM [] +| | | PathDefault [] +| | | Const [{}] +| | PathComposeM [] +| | | PathField [b] +| | | PathConstant [] +| | | Variable [projRenamedPath_0] +| | PathKeep [b] +| PathKeep [_id, a] +Evaluation [{projRenamedPath_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [c] +| PathIdentity [] +Scan [collection, {scan_0}] ==== VARIATION: project rename dotted paths ==== @@ -115,42 +101,35 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathComposeM [] -| | PathField [a] -| | PathTraverse [inf] -| | PathComposeM [] -| | | PathField [b] -| | | PathTraverse [inf] -| | | PathComposeM [] -| | | | PathDefault [] -| | | | Const [{}] -| | | PathComposeM [] -| | | | PathField [c] -| | | | PathConstant [] -| | | | Variable [projGetPath_0] -| | | PathKeep [c] -| | PathKeep [b] -| PathKeep [_id, a] -Evaluation [] -| BindBlock: -| [projGetPath_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [x] -| PathTraverse [inf] -| PathGet [y] -| PathTraverse [inf] -| PathGet [z] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathField [a] +| | PathTraverse [inf] +| | PathComposeM [] +| | | PathField [b] +| | | PathTraverse [inf] +| | | PathComposeM [] +| | | | PathDefault [] +| | | | Const [{}] +| | | PathComposeM [] +| | | | PathField [c] +| | | | PathConstant [] +| | | | Variable [projGetPath_0] +| | | PathKeep [c] +| | PathKeep [b] +| PathKeep [_id, a] +Evaluation [{projGetPath_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [x] +| PathTraverse [inf] +| PathGet [y] +| PathTraverse [inf] +| PathGet [z] +| PathIdentity [] +Scan [collection, {scan_0}] ==== VARIATION: inclusion project with computed field ==== @@ -174,34 +153,27 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathComposeM [] -| | PathDefault [] -| | Const [{}] -| PathComposeM [] -| | PathField [a] -| | PathConstant [] -| | Variable [projGetPath_0] -| PathKeep [_id, a, b] -Evaluation [] -| BindBlock: -| [projGetPath_0] -| BinaryOp [Add] -| | Const [2] -| EvalPath [] -| | Variable [scan_0] -| PathGet [c] -| PathTraverse [inf] -| PathGet [d] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathComposeM [] +| | PathField [a] +| | PathConstant [] +| | Variable [projGetPath_0] +| PathKeep [_id, a, b] +Evaluation [{projGetPath_0}] +| BinaryOp [Add] +| | Const [2] +| EvalPath [] +| | Variable [scan_0] +| PathGet [c] +| PathTraverse [inf] +| PathGet [d] +| PathIdentity [] +Scan [collection, {scan_0}] ==== VARIATION: replaceRoot ==== @@ -225,17 +197,12 @@ Root [] | | newRoot_0 | RefBlock: | Variable [newRoot_0] -Evaluation [] -| BindBlock: -| [newRoot_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [a] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{newRoot_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathIdentity [] +Scan [collection, {scan_0}] ==== VARIATION: $project with computed array ==== @@ -259,34 +226,27 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathComposeM [] -| | PathDefault [] -| | Const [{}] -| PathComposeM [] -| | PathField [a] -| | PathConstant [] -| | Variable [projGetPath_0] -| PathKeep [_id, a] -Evaluation [] -| BindBlock: -| [projGetPath_0] -| FunctionCall [newArray] -| | EvalPath [] -| | | Variable [scan_0] -| | PathGet [c] -| | PathIdentity [] -| EvalPath [] -| | Variable [scan_0] -| PathGet [b] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathComposeM [] +| | PathField [a] +| | PathConstant [] +| | Variable [projGetPath_0] +| PathKeep [_id, a] +Evaluation [{projGetPath_0}] +| FunctionCall [newArray] +| | EvalPath [] +| | | Variable [scan_0] +| | PathGet [c] +| | PathIdentity [] +| EvalPath [] +| | Variable [scan_0] +| PathGet [b] +| PathIdentity [] +Scan [collection, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/elem_match_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/elem_match_translation.txt index 0e2ec967987..75a61005e80 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/elem_match_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/elem_match_translation.txt @@ -32,10 +32,7 @@ Filter [] | | PathObj [] | PathConstant [] | Const [true] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: ensure the PathGet and PathTraverse operators interact correctly when $in is under $elemMatch ==== @@ -70,10 +67,7 @@ Filter [] | PathTraverse [1] | PathCompare [EqMember] | Const [[1, 2, 3]] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match with value $elemMatch: observe type bracketing in the filter. ==== @@ -115,27 +109,20 @@ Filter [] | | Const [nan] | PathCompare [Lte] | Const [3] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathComposeM [] -| | PathDefault [] -| | Const [{}] -| PathComposeM [] -| | PathField [a] -| | PathConstant [] -| | Variable [projGetPath_0] -| PathKeep [_id, a] -Evaluation [] -| BindBlock: -| [projGetPath_0] -| Const [[1, 2, 3, 4]] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathComposeM [] +| | PathField [a] +| | PathConstant [] +| | Variable [projGetPath_0] +| PathKeep [_id, a] +Evaluation [{projGetPath_0}] +| Const [[1, 2, 3, 4]] +Scan [collection, {scan_0}] ==== VARIATION: $match object $elemMatch ==== @@ -174,9 +161,6 @@ Filter [] | PathTraverse [1] | PathCompare [Eq] | Const [5] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/eq_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/eq_translation.txt index a4f2c4cff43..1bb8ff73482 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/eq_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/eq_translation.txt @@ -26,10 +26,7 @@ Filter [] | PathTraverse [1] | PathCompare [Eq] | Const [1] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match with $expr $eq with dotted path ==== @@ -65,10 +62,7 @@ Filter [] | PathTraverse [inf] | PathGet [b] | PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match with $expr $eq ==== @@ -98,9 +92,6 @@ Filter [] | PathGet [a] | PathCompare [Eq] | Const [1] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/exists_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/exists_translation.txt index 9e54ff175cb..73ba58e137c 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/exists_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/exists_translation.txt @@ -25,10 +25,7 @@ Filter [] | PathGet [a] | PathDefault [] | Const [false] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match exists ==== @@ -62,10 +59,7 @@ Filter [] | PathGet [a] | PathDefault [] | Const [false] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match exists ==== @@ -97,9 +91,6 @@ Filter [] | PathGet [b] | PathDefault [] | Const [false] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/group_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/group_translation.txt index e8a85abf5e3..d4d5a940710 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/group_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/group_translation.txt @@ -34,35 +34,28 @@ Filter [] | | Const [""] | PathCompare [Gte] | Const [10] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathComposeM [] -| | PathDefault [] -| | Const [{}] -| PathComposeM [] -| | PathField [s] -| | PathConstant [] -| | Variable [projGetPath_0] -| PathKeep [_id, c, s] -Evaluation [] -| BindBlock: -| [projGetPath_0] -| BinaryOp [Add] -| | EvalPath [] -| | | Variable [scan_0] -| | PathGet [b] -| | PathIdentity [] -| EvalPath [] -| | Variable [scan_0] -| PathGet [a] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathDefault [] +| | Const [{}] +| PathComposeM [] +| | PathField [s] +| | PathConstant [] +| | Variable [projGetPath_0] +| PathKeep [_id, c, s] +Evaluation [{projGetPath_0}] +| BinaryOp [Add] +| | EvalPath [] +| | | Variable [scan_0] +| | PathGet [b] +| | PathIdentity [] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathIdentity [] +Scan [collection, {scan_0}] ==== VARIATION: basic $group ==== @@ -86,18 +79,16 @@ Root [] | | agg_project_0 | RefBlock: | Variable [agg_project_0] -Evaluation [] -| BindBlock: -| [agg_project_0] -| EvalPath [] -| | Const [{}] -| PathComposeM [] -| | PathField [s] -| | PathConstant [] -| | Variable [field_agg_0] -| PathField [_id] -| PathConstant [] -| Variable [groupByProj_0] +Evaluation [{agg_project_0}] +| EvalPath [] +| | Const [{}] +| PathComposeM [] +| | PathField [s] +| | PathConstant [] +| | Variable [field_agg_0] +| PathField [_id] +| PathConstant [] +| Variable [groupByProj_0] GroupBy [] | | groupings: | | RefBlock: @@ -106,31 +97,24 @@ GroupBy [] | [field_agg_0] | FunctionCall [$sum] | Variable [groupByInputProj_0] -Evaluation [] -| BindBlock: -| [groupByInputProj_0] -| BinaryOp [Mult] -| | EvalPath [] -| | | Variable [scan_0] -| | PathGet [c] -| | PathIdentity [] -| EvalPath [] -| | Variable [scan_0] -| PathGet [b] -| PathIdentity [] -Evaluation [] -| BindBlock: -| [groupByProj_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [a] -| PathTraverse [inf] -| PathGet [b] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{groupByInputProj_0}] +| BinaryOp [Mult] +| | EvalPath [] +| | | Variable [scan_0] +| | PathGet [c] +| | PathIdentity [] +| EvalPath [] +| | Variable [scan_0] +| PathGet [b] +| PathIdentity [] +Evaluation [{groupByProj_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathTraverse [inf] +| PathGet [b] +| PathIdentity [] +Scan [collection, {scan_0}] ==== VARIATION: $group local global ==== @@ -154,18 +138,16 @@ Root [] | | agg_project_0 | RefBlock: | Variable [agg_project_0] -Evaluation [] -| BindBlock: -| [agg_project_0] -| EvalPath [] -| | Const [{}] -| PathComposeM [] -| | PathField [c] -| | PathConstant [] -| | Variable [field_agg_0] -| PathField [_id] -| PathConstant [] -| Variable [groupByProj_0] +Evaluation [{agg_project_0}] +| EvalPath [] +| | Const [{}] +| PathComposeM [] +| | PathField [c] +| | PathConstant [] +| | Variable [field_agg_0] +| PathField [_id] +| PathConstant [] +| Variable [groupByProj_0] GroupBy [] | | groupings: | | RefBlock: @@ -174,24 +156,17 @@ GroupBy [] | [field_agg_0] | FunctionCall [$sum] | Variable [groupByInputProj_0] -Evaluation [] -| BindBlock: -| [groupByInputProj_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [b] -| PathIdentity [] -Evaluation [] -| BindBlock: -| [groupByProj_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [a] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{groupByInputProj_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [b] +| PathIdentity [] +Evaluation [{groupByProj_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathIdentity [] +Scan [collection, {scan_0}] ==== VARIATION: $group with complex _id ==== @@ -215,27 +190,25 @@ Root [] | | agg_project_0 | RefBlock: | Variable [agg_project_0] -Evaluation [] -| BindBlock: -| [agg_project_0] -| EvalPath [] -| | Const [{}] -| PathComposeM [] -| | PathField [open] -| | PathConstant [] -| | Variable [field_agg_1] -| PathComposeM [] -| | PathField [count] -| | PathConstant [] -| | Variable [field_agg_0] -| PathField [_id] -| PathComposeM [] -| | PathField [year] -| | PathConstant [] -| | Variable [groupByProj_1] -| PathField [isin] -| PathConstant [] -| Variable [groupByProj_0] +Evaluation [{agg_project_0}] +| EvalPath [] +| | Const [{}] +| PathComposeM [] +| | PathField [open] +| | PathConstant [] +| | Variable [field_agg_1] +| PathComposeM [] +| | PathField [count] +| | PathConstant [] +| | Variable [field_agg_0] +| PathField [_id] +| PathComposeM [] +| | PathField [year] +| | PathConstant [] +| | Variable [groupByProj_1] +| PathField [isin] +| PathConstant [] +| Variable [groupByProj_0] GroupBy [] | | groupings: | | RefBlock: @@ -248,23 +221,16 @@ GroupBy [] | [field_agg_1] | FunctionCall [$first] | Variable [scan_0] -Evaluation [] -| BindBlock: -| [groupByProj_1] -| EvalPath [] -| | Variable [scan_0] -| PathGet [year] -| PathIdentity [] -Evaluation [] -| BindBlock: -| [groupByProj_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [isin] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{groupByProj_1}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [year] +| PathIdentity [] +Evaluation [{groupByProj_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [isin] +| PathIdentity [] +Scan [collection, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/in_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/in_translation.txt index 8f9e809dff0..0b9fb117926 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/in_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/in_translation.txt @@ -24,10 +24,7 @@ Filter [] | | Variable [scan_0] | PathConstant [] | Const [false] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: match with $in, singleton list ==== @@ -58,10 +55,7 @@ Filter [] | PathTraverse [1] | PathCompare [Eq] | Const [1] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match with $in and a list of equalities becomes a comparison to an EqMember list. ==== @@ -92,10 +86,7 @@ Filter [] | PathTraverse [1] | PathCompare [EqMember] | Const [[1, 2, 3]] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: match with $in over an array, duplicated equalities removed ==== @@ -126,9 +117,6 @@ Filter [] | PathTraverse [1] | PathCompare [EqMember] | Const [["abc", "def", "ghi"]] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/inequality_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/inequality_translation.txt index 9cf22a0dd46..65df571b159 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/inequality_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/inequality_translation.txt @@ -29,10 +29,7 @@ Filter [] | | Const [""] | PathCompare [Gt] | Const [70] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match with range conjunction ==== @@ -76,9 +73,6 @@ Filter [] | | Const [nan] | PathCompare [Lt] | Const [90] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/not_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/not_translation.txt index 4941a502406..e59a5acfa23 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/not_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/not_translation.txt @@ -29,10 +29,7 @@ Filter [] | PathGet [a] | PathDefault [] | Const [false] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match not ==== @@ -67,10 +64,7 @@ Filter [] | PathTraverse [1] | PathCompare [Eq] | Const [5] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match with $ne ==== @@ -105,9 +99,6 @@ Filter [] | PathTraverse [1] | PathCompare [Eq] | Const [2] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/simple_projection_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/simple_projection_translation.txt index 67d992bcb3a..ac27c3ad999 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/simple_projection_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/simple_projection_translation.txt @@ -19,16 +19,11 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathKeep [_id, a1, a2, a3, a4, a5, a6] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathKeep [_id, a1, a2, a3, a4, a5, a6] +Scan [collection, {scan_0}] ==== VARIATION: inclusion project dotted paths ==== @@ -52,22 +47,17 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathComposeM [] -| | PathField [a] -| | PathTraverse [inf] -| | PathComposeM [] -| | | PathKeep [b, c] -| | PathObj [] -| PathKeep [_id, a, b] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathField [a] +| | PathTraverse [inf] +| | PathComposeM [] +| | | PathKeep [b, c] +| | PathObj [] +| PathKeep [_id, a, b] +Scan [collection, {scan_0}] ==== VARIATION: exclusion project ==== @@ -91,16 +81,11 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathDrop [a, b] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathDrop [a, b] +Scan [collection, {scan_0}] ==== VARIATION: $project with deeply nested path ==== @@ -124,54 +109,47 @@ Root [] | | combinedProjection_0 | RefBlock: | Variable [combinedProjection_0] -Evaluation [] -| BindBlock: -| [combinedProjection_0] -| EvalPath [] -| | Variable [scan_0] -| PathComposeM [] -| | PathField [a1] -| | PathTraverse [inf] -| | PathComposeM [] -| | | PathField [b] -| | | PathTraverse [inf] -| | | PathComposeM [] -| | | | PathKeep [c] -| | | PathObj [] -| | PathComposeM [] -| | | PathKeep [b] -| | PathObj [] -| PathComposeM [] -| | PathField [a] -| | PathTraverse [inf] -| | PathComposeM [] -| | | PathField [b] -| | | PathTraverse [inf] -| | | PathComposeM [] -| | | | PathField [c] -| | | | PathTraverse [inf] -| | | | PathComposeM [] -| | | | | PathField [d] -| | | | | PathTraverse [inf] -| | | | | PathComposeM [] -| | | | | | PathDefault [] -| | | | | | Const [{}] -| | | | | PathComposeM [] -| | | | | | PathField [e] -| | | | | | PathConstant [] -| | | | | | Variable [projGetPath_0] -| | | | | PathKeep [e] -| | | | PathKeep [d] -| | | PathKeep [c] -| | PathKeep [b] -| PathKeep [_id, a, a1] -Evaluation [] -| BindBlock: -| [projGetPath_0] -| Const ["str"] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{combinedProjection_0}] +| EvalPath [] +| | Variable [scan_0] +| PathComposeM [] +| | PathField [a1] +| | PathTraverse [inf] +| | PathComposeM [] +| | | PathField [b] +| | | PathTraverse [inf] +| | | PathComposeM [] +| | | | PathKeep [c] +| | | PathObj [] +| | PathComposeM [] +| | | PathKeep [b] +| | PathObj [] +| PathComposeM [] +| | PathField [a] +| | PathTraverse [inf] +| | PathComposeM [] +| | | PathField [b] +| | | PathTraverse [inf] +| | | PathComposeM [] +| | | | PathField [c] +| | | | PathTraverse [inf] +| | | | PathComposeM [] +| | | | | PathField [d] +| | | | | PathTraverse [inf] +| | | | | PathComposeM [] +| | | | | | PathDefault [] +| | | | | | Const [{}] +| | | | | PathComposeM [] +| | | | | | PathField [e] +| | | | | | PathConstant [] +| | | | | | Variable [projGetPath_0] +| | | | | PathKeep [e] +| | | | PathKeep [d] +| | | PathKeep [c] +| | PathKeep [b] +| PathKeep [_id, a, a1] +Evaluation [{projGetPath_0}] +| Const ["str"] +Scan [collection, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/sort_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/sort_translation.txt index dd29f45af96..d73e3db1df7 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/sort_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/sort_translation.txt @@ -26,20 +26,16 @@ Collation [] | RefBlock: | Variable [sort_0] | Variable [sort_1] -Evaluation [] -| BindBlock: -| [sort_1] -| EvalPath [] -| | Variable [scan_0] -| PathGet [b] -| PathIdentity [] -Evaluation [] -| BindBlock: -| [sort_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [a] -| PathIdentity [] +Evaluation [{sort_1}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [b] +| PathIdentity [] +Evaluation [{sort_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathIdentity [] LimitSkip [] | limitSkip: | limit: (none) @@ -48,10 +44,7 @@ LimitSkip [] | limitSkip: | limit: 5 | skip: 0 -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] ==== VARIATION: $match sort ==== @@ -80,13 +73,11 @@ Collation [] | | sort_0: Ascending | RefBlock: | Variable [sort_0] -Evaluation [] -| BindBlock: -| [sort_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [a] -| PathIdentity [] +Evaluation [{sort_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathIdentity [] Filter [] | EvalFilter [] | | Variable [scan_0] @@ -94,9 +85,6 @@ Filter [] | PathTraverse [1] | PathCompare [Eq] | Const [10] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Scan [collection, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/union_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/union_translation.txt index b0fb2015f14..ba611d20149 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/union_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/union_translation.txt @@ -34,23 +34,12 @@ Filter [] | PathTraverse [1] | PathCompare [Eq] | Const [1] -Union [] -| | BindBlock: -| | [scan_0] -| | Source [] -| Evaluation [] -| | BindBlock: -| | [scan_0] -| | EvalPath [] -| | | Variable [scan_1] -| | PathIdentity [] -| Scan [collB] -| BindBlock: -| [scan_1] -| Source [] -Scan [collA] - BindBlock: - [scan_0] - Source [] +Union [{scan_0}] +| Evaluation [{scan_0}] +| | EvalPath [] +| | | Variable [scan_1] +| | PathIdentity [] +| Scan [collB, {scan_1}] +Scan [collA, {scan_0}] diff --git a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/unwind_translation.txt b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/unwind_translation.txt index 7af41c58f93..a0231d15ee8 100644 --- a/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/unwind_translation.txt +++ b/src/mongo/db/test_output/pipeline/abt/a_b_t_translation_test/unwind_translation.txt @@ -19,37 +19,25 @@ Root [] | | embedProj_0 | RefBlock: | Variable [embedProj_0] -Evaluation [] -| BindBlock: -| [embedProj_0] -| EvalPath [] -| | Variable [scan_0] -| PathField [a] -| PathTraverse [inf] -| PathField [b] -| PathTraverse [inf] -| PathField [c] -| PathConstant [] -| Variable [unwoundProj_0] +Evaluation [{embedProj_0}] +| EvalPath [] +| | Variable [scan_0] +| PathField [a] +| PathTraverse [inf] +| PathField [b] +| PathTraverse [inf] +| PathField [c] +| PathConstant [] +| Variable [unwoundProj_0] Unwind [] -| BindBlock: -| [unwoundPid_0] -| Source [] -| [unwoundProj_0] -| Source [] -Evaluation [] -| BindBlock: -| [unwoundProj_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [a] -| PathGet [b] -| PathGet [c] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{unwoundProj_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathGet [b] +| PathGet [c] +| PathIdentity [] +Scan [collection, {scan_0}] ==== VARIATION: complex $unwind ==== @@ -73,57 +61,43 @@ Root [] | | embedPidProj_0 | RefBlock: | Variable [embedPidProj_0] -Evaluation [] -| BindBlock: -| [embedPidProj_0] -| EvalPath [] -| | Variable [embedProj_0] -| PathField [p1] -| PathField [pid] -| PathConstant [] -| If [] -| | | Const [null] -| | Variable [unwoundPid_0] -| BinaryOp [Gte] -| | Const [0] -| Variable [unwoundPid_0] -Evaluation [] -| BindBlock: -| [embedProj_0] -| EvalPath [] -| | Variable [scan_0] -| PathField [a] -| PathTraverse [inf] -| PathField [b] -| PathTraverse [inf] -| PathField [c] -| PathLambda [] -| LambdaAbstraction [unwoundLambdaVarName_0] -| If [] -| | | Variable [unwoundLambdaVarName_0] -| | Variable [unwoundProj_0] -| BinaryOp [Gte] -| | Const [0] -| Variable [unwoundPid_0] +Evaluation [{embedPidProj_0}] +| EvalPath [] +| | Variable [embedProj_0] +| PathField [p1] +| PathField [pid] +| PathConstant [] +| If [] +| | | Const [null] +| | Variable [unwoundPid_0] +| BinaryOp [Gte] +| | Const [0] +| Variable [unwoundPid_0] +Evaluation [{embedProj_0}] +| EvalPath [] +| | Variable [scan_0] +| PathField [a] +| PathTraverse [inf] +| PathField [b] +| PathTraverse [inf] +| PathField [c] +| PathLambda [] +| LambdaAbstraction [unwoundLambdaVarName_0] +| If [] +| | | Variable [unwoundLambdaVarName_0] +| | Variable [unwoundProj_0] +| BinaryOp [Gte] +| | Const [0] +| Variable [unwoundPid_0] Unwind [retainNonArrays] -| BindBlock: -| [unwoundPid_0] -| Source [] -| [unwoundProj_0] -| Source [] -Evaluation [] -| BindBlock: -| [unwoundProj_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [a] -| PathGet [b] -| PathGet [c] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{unwoundProj_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathGet [b] +| PathGet [c] +| PathIdentity [] +Scan [collection, {scan_0}] ==== VARIATION: $unwind with $group ==== @@ -147,61 +121,45 @@ Root [] | | agg_project_0 | RefBlock: | Variable [agg_project_0] -Evaluation [] -| BindBlock: -| [agg_project_0] -| EvalPath [] -| | Const [{}] -| PathField [_id] -| PathConstant [] -| Variable [groupByProj_0] +Evaluation [{agg_project_0}] +| EvalPath [] +| | Const [{}] +| PathField [_id] +| PathConstant [] +| Variable [groupByProj_0] GroupBy [] | | groupings: | | RefBlock: | | Variable [groupByProj_0] | aggregations: -Evaluation [] -| BindBlock: -| [groupByProj_0] -| EvalPath [] -| | Variable [embedProj_0] -| PathGet [a] -| PathTraverse [inf] -| PathGet [b] -| PathIdentity [] -Evaluation [] -| BindBlock: -| [embedProj_0] -| EvalPath [] -| | Variable [scan_0] -| PathField [a] -| PathTraverse [inf] -| PathField [b] -| PathLambda [] -| LambdaAbstraction [unwoundLambdaVarName_0] -| If [] -| | | Variable [unwoundLambdaVarName_0] -| | Variable [unwoundProj_0] -| BinaryOp [Gte] -| | Const [0] -| Variable [unwoundPid_0] +Evaluation [{groupByProj_0}] +| EvalPath [] +| | Variable [embedProj_0] +| PathGet [a] +| PathTraverse [inf] +| PathGet [b] +| PathIdentity [] +Evaluation [{embedProj_0}] +| EvalPath [] +| | Variable [scan_0] +| PathField [a] +| PathTraverse [inf] +| PathField [b] +| PathLambda [] +| LambdaAbstraction [unwoundLambdaVarName_0] +| If [] +| | | Variable [unwoundLambdaVarName_0] +| | Variable [unwoundProj_0] +| BinaryOp [Gte] +| | Const [0] +| Variable [unwoundPid_0] Unwind [retainNonArrays] -| BindBlock: -| [unwoundPid_0] -| Source [] -| [unwoundProj_0] -| Source [] -Evaluation [] -| BindBlock: -| [unwoundProj_0] -| EvalPath [] -| | Variable [scan_0] -| PathGet [a] -| PathGet [b] -| PathIdentity [] -Scan [collection] - BindBlock: - [scan_0] - Source [] +Evaluation [{unwoundProj_0}] +| EvalPath [] +| | Variable [scan_0] +| PathGet [a] +| PathGet [b] +| PathIdentity [] +Scan [collection, {scan_0}] |