Skip to content

Commit

Permalink
[KQP] Plan fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pashandor789 committed Sep 19, 2024
1 parent e555b24 commit 5c04260
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion ydb/core/kqp/ut/join/kqp_join_order_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void PrintPlan(const TString& plan) {
class TChainTester {
public:
TChainTester(size_t chainSize)
: Kikimr(GetKikimrWithJoinSettings())
: Kikimr(GetKikimrWithJoinSettings(false, GetStats(chainSize)))
, TableClient(Kikimr.GetTableClient())
, Session(TableClient.CreateSession().GetValueSync().GetSession())
, ChainSize(chainSize)
Expand All @@ -112,6 +112,21 @@ class TChainTester {
JoinTables();
}

static TString GetStats(size_t chainSize) {
srand(228);
NJson::TJsonValue stats;
for (size_t i = 0; i < chainSize; ++i) {
ui64 nRows = rand();
NJson::TJsonValue tableStat;
tableStat["n_rows"] = nRows;
tableStat["byte_size"] = nRows * 10;

TString table = Sprintf("/Root/table_%ld", i);
stats[table] = std::move(tableStat);
}
return stats.GetStringRobust();
}

private:
void CreateTables() {
for (size_t i = 0; i < ChainSize; ++i) {
Expand All @@ -133,6 +148,17 @@ class TChainTester {

joinRequest.append("SELECT * FROM `/Root/table_0` as t0 ");

srand(228);
NJson::TJsonValue stats;
for (size_t i = 0; i < ChainSize; ++i) {
TString table = Sprintf("/Root/table_%ld", i);
int nRows = rand();
NJson::TJsonValue tableStat;
tableStat[table]["n_rows"] = nRows;
tableStat[table]["byte_size"] = nRows * 10;
stats.AppendValue(std::move(tableStat));
}

for (size_t i = 1; i < ChainSize; ++i) {
TString table = Sprintf("/Root/table_%ld", i);

Expand Down

0 comments on commit 5c04260

Please sign in to comment.