diff options
author | Ruoxin Xu <ruoxin.xu@mongodb.com> | 2022-11-28 16:50:50 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-28 18:41:02 +0000 |
commit | d0ad3c39b58a17c14873b6a478b5eab34d15f2f4 (patch) | |
tree | 32ee76dea68c3d6e1a09d810095e2baa4fed2a75 | |
parent | 49a8ce154ade1f0c36c91ad287cd078fad7924d9 (diff) | |
download | mongo-d0ad3c39b58a17c14873b6a478b5eab34d15f2f4.tar.gz |
SERVER-71629 Robustify query cost_model_test
-rw-r--r-- | src/mongo/db/query/cost_model/cost_model_test.cpp | 36 |
1 files changed, 5 insertions, 31 deletions
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 61dbf04d2e7..c25c470055d 100644 --- a/src/mongo/db/query/cost_model/cost_model_test.cpp +++ b/src/mongo/db/query/cost_model/cost_model_test.cpp @@ -244,37 +244,11 @@ TEST(CostModel, IncreaseJoinsCost) { ABT optimized = rootNode; phaseManager.optimize(optimized); - ASSERT_EXPLAIN_V2( - "Root []\n" - "| | projections: \n" - "| | pa\n" - "| RefBlock: \n" - "| Variable [pa]\n" - "BinaryJoin [joinType: Inner, {rid_0}]\n" - "| | Const [true]\n" - "| Filter []\n" - "| | EvalFilter []\n" - "| | | Variable [evalTemp_2]\n" - "| | PathCompare [Eq]\n" - "| | Const [2]\n" - "| LimitSkip []\n" - "| | limitSkip:\n" - "| | limit: 1\n" - "| | skip: 0\n" - "| Seek [ridProjection: rid_0, {'b': evalTemp_2}, c1]\n" - "| | BindBlock:\n" - "| | [evalTemp_2]\n" - "| | Source []\n" - "| RefBlock: \n" - "| Variable [rid_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", - optimized); + auto optimizedExplain = ExplainGenerator::explainV2(optimized); + + // Verifies that a BinaryJoin plan is generated not a MergeJoin plan. + ASSERT_NE(optimizedExplain.find("BinaryJoin"), std::string::npos); + ASSERT_EQ(optimizedExplain.find("MergeJoin"), std::string::npos); } { |