Skip to content

Commit 80b1b17

Browse files
committed
[CBO] Improve transitive closure algorithm, add cycles processing
1 parent b4ac18d commit 80b1b17

22 files changed

+937
-606
lines changed

ydb/core/kqp/ut/common/kqp_ut_common.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,24 @@ NJson::TJsonValue GetJoinOrder(const TString& deserializedPlan) {
14681468
return GetJoinOrderImpl(optRoot);
14691469
}
14701470

1471+
NJson::TJsonValue GetJoinOrderFromDetailedJoinOrderImpl(const NJson::TJsonValue& opt) {
1472+
if (!opt.GetMapSafe().contains("table")) {
1473+
NJson::TJsonValue res;
1474+
auto args = opt.GetMapSafe().at("args").GetArraySafe();
1475+
for (size_t i = 0; i < args.size(); ++i) {
1476+
res.AppendValue(GetJoinOrderFromDetailedJoinOrderImpl(args[i]));
1477+
}
1478+
return res;
1479+
}
1480+
1481+
return opt.GetMapSafe().at("table");
1482+
}
1483+
1484+
NJson::TJsonValue GetJoinOrderFromDetailedJoinOrder(const TString& deserializedDetailedJoinOrder) {
1485+
NJson::TJsonValue optRoot;
1486+
NJson::ReadJsonTree(deserializedDetailedJoinOrder, &optRoot, true);
1487+
return GetJoinOrderFromDetailedJoinOrderImpl(optRoot);
1488+
}
14711489

14721490
} // namspace NKqp
14731491
} // namespace NKikimr

ydb/core/kqp/ut/common/kqp_ut_common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,5 +381,7 @@ NJson::TJsonValue GetDetailedJoinOrder(const TString& deserializedPlan, const TG
381381
/* Gets tables join order without details : only tables. */
382382
NJson::TJsonValue GetJoinOrder(const TString& deserializedPlan);
383383

384+
NJson::TJsonValue GetJoinOrderFromDetailedJoinOrder(const TString& deserializedDetailedJoinOrder);
385+
384386
} // namespace NKqp
385387
} // namespace NKikimr

ydb/core/kqp/ut/join/data/join_order/lookupbug.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@
3232
}
3333
]
3434
}
35+

ydb/core/kqp/ut/join/data/join_order/tpcc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
}
1313
]
1414
}
15+

ydb/core/kqp/ut/join/data/join_order/tpcds64_1000s.json

Lines changed: 141 additions & 140 deletions
Large diffs are not rendered by default.

ydb/core/kqp/ut/join/data/join_order/tpcds64_1000s_column_store.json

Lines changed: 141 additions & 140 deletions
Large diffs are not rendered by default.

ydb/core/kqp/ut/join/data/join_order/tpcds64_small_1000s.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@
5252
}
5353
]
5454
}
55+

ydb/core/kqp/ut/join/data/join_order/tpcds64_small_1000s_column_store.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@
5252
}
5353
]
5454
}
55+

ydb/core/kqp/ut/join/data/join_order/tpcds78_1000s.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@
8282
}
8383
]
8484
}
85+

ydb/core/kqp/ut/join/data/join_order/tpcds78_1000s_column_store.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@
8282
}
8383
]
8484
}
85+

0 commit comments

Comments
 (0)