Skip to content

[CBO] added enableshuffleelimination flag #15218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ydb/core/kqp/opt/logical/kqp_opt_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class TKqpLogicalOptTransformer : public TOptimizeTransformerBase {
public:
TStatus DoTransform(TExprNode::TPtr input, TExprNode::TPtr& output, TExprContext& ctx) override {
auto status = TOptimizeTransformerBase::DoTransform(input, output, ctx);

if (status == TStatus::Ok) {
for (const auto& hint: KqpCtx.GetOptimizerHints().GetUnappliedString()) {
ctx.AddWarning(YqlIssue({}, TIssuesIds::YQL_UNUSED_HINT, "Unapplied hint: " + hint));
Expand All @@ -118,7 +118,7 @@ class TKqpLogicalOptTransformer : public TOptimizeTransformerBase {
TMaybeNode<TExprBase> RewriteAggregate(TExprBase node, TExprContext& ctx) {
TMaybeNode<TExprBase> output;
auto aggregate = node.Cast<TCoAggregateBase>();
auto hopSetting = GetSetting(aggregate.Settings().Ref(), "hopping");
auto hopSetting = GetSetting(aggregate.Settings().Ref(), "hopping");
if (hopSetting) {
auto input = aggregate.Input().Maybe<TDqConnection>();
if (!input) {
Expand Down Expand Up @@ -163,8 +163,9 @@ class TKqpLogicalOptTransformer : public TOptimizeTransformerBase {
TMaybeNode<TExprBase> OptimizeEquiJoinWithCosts(TExprBase node, TExprContext& ctx) {
auto maxDPhypDPTableSize = Config->MaxDPHypDPTableSize.Get().GetOrElse(TDqSettings::TDefault::MaxDPHypDPTableSize);
auto optLevel = Config->CostBasedOptimizationLevel.Get().GetOrElse(Config->DefaultCostBasedOptimizationLevel);
bool enableShuffleElimination = KqpCtx.Config->OptShuffleElimination.Get().GetOrElse(false);;
auto providerCtx = TKqpProviderContext(KqpCtx, optLevel);
auto opt = std::unique_ptr<IOptimizerNew>(MakeNativeOptimizerNew(providerCtx, maxDPhypDPTableSize, ctx));
auto opt = std::unique_ptr<IOptimizerNew>(MakeNativeOptimizerNew(providerCtx, maxDPhypDPTableSize, ctx, enableShuffleElimination));
TExprBase output = DqOptimizeEquiJoinWithCosts(node, ctx, TypesCtx, optLevel,
*opt, [](auto& rels, auto label, auto node, auto stat) {
rels.emplace_back(std::make_shared<TKqpRelOptimizerNode>(TString(label), *stat, node));
Expand Down
14 changes: 7 additions & 7 deletions ydb/core/kqp/ut/join/data/join_order/lookupbug.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
"op_name":"LeftJoin (MapJoin)",
"args":
[
{
"op_name":"TableFullScan",
"table":"quotas_browsers_relation"
},
{
"op_name":"LeftJoin (MapJoin)",
"args":
[
{
"op_name":"TableFullScan",
"table":"browsers"
"table":"quotas_browsers_relation"
},
{
"op_name":"TableFullScan",
"table":"browser_groups"
"op_name":"TableLookup",
"table":"browsers"
}
]
},
{
"op_name":"TableLookup",
"table":"browser_groups"
}
]
},
Expand Down
6 changes: 3 additions & 3 deletions ydb/core/kqp/ut/join/data/join_order/tpcc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"args":
[
{
"op_name":"TableRangeScan",
"table":"test\/tpcc\/order_line"
"op_name":"TableLookup",
"table":"test\/tpcc\/stock"
},
{
"op_name":"TableRangeScan",
"table":"test\/tpcc\/stock"
"table":"test\/tpcc\/order_line"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"op_name":"InnerJoin (MapJoin)",
"op_name":"InnerJoin (Grace)",
"args":
[
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"op_name":"InnerJoin (MapJoin)",
"op_name":"InnerJoin (Grace)",
"args":
[
{
Expand Down
36 changes: 18 additions & 18 deletions ydb/core/kqp/ut/join/data/join_order/tpcds78_1000s.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,37 @@
"args":
[
{
"op_name":"InnerJoin (MapJoin)",
"op_name":"LeftJoin (Grace)",
"args":
[
{
"op_name":"LeftJoin (Grace)",
"op_name":"InnerJoin (MapJoin)",
"args":
[
{
"op_name":"TableFullScan",
"table":"test\/ds\/store_sales"
},
{
"op_name":"TableFullScan",
"table":"test\/ds\/store_returns"
"op_name":"Union",
"args":
[
{
"op_name":"TableFullScan",
"table":"test\/ds\/date_dim"
}
]
}
]
},
{
"op_name":"Union",
"args":
[
{
"op_name":"TableFullScan",
"table":"test\/ds\/date_dim"
}
]
"op_name":"TableFullScan",
"table":"test\/ds\/store_returns"
}
]
},
{
"op_name":"InnerJoin (Grace)",
"op_name":"InnerJoin (MapJoin)",
"args":
[
{
Expand All @@ -46,11 +46,11 @@
[
{
"op_name":"TableFullScan",
"table":"test\/ds\/catalog_sales"
"table":"test\/ds\/web_sales"
},
{
"op_name":"TableFullScan",
"table":"test\/ds\/catalog_returns"
"table":"test\/ds\/web_returns"
}
]
},
Expand All @@ -69,7 +69,7 @@
]
},
{
"op_name":"InnerJoin (Grace)",
"op_name":"InnerJoin (MapJoin)",
"args":
[
{
Expand All @@ -78,11 +78,11 @@
[
{
"op_name":"TableFullScan",
"table":"test\/ds\/web_sales"
"table":"test\/ds\/catalog_sales"
},
{
"op_name":"TableFullScan",
"table":"test\/ds\/web_returns"
"table":"test\/ds\/catalog_returns"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"args":
[
{
"op_name":"InnerJoin (MapJoin)",
"op_name":"LeftJoin (Grace)",
"args":
[
{
"op_name":"LeftJoin (Grace)",
"op_name":"InnerJoin (MapJoin)",
"args":
[
{
Expand All @@ -20,18 +20,18 @@
},
{
"op_name":"TableFullScan",
"table":"test\/ds\/store_returns"
"table":"test\/ds\/date_dim"
}
]
},
{
"op_name":"TableFullScan",
"table":"test\/ds\/date_dim"
"table":"test\/ds\/store_returns"
}
]
},
{
"op_name":"InnerJoin (Grace)",
"op_name":"InnerJoin (MapJoin)",
"args":
[
{
Expand All @@ -40,11 +40,11 @@
[
{
"op_name":"TableFullScan",
"table":"test\/ds\/catalog_sales"
"table":"test\/ds\/web_sales"
},
{
"op_name":"TableFullScan",
"table":"test\/ds\/catalog_returns"
"table":"test\/ds\/web_returns"
}
]
},
Expand All @@ -57,7 +57,7 @@
]
},
{
"op_name":"InnerJoin (Grace)",
"op_name":"InnerJoin (MapJoin)",
"args":
[
{
Expand All @@ -66,11 +66,11 @@
[
{
"op_name":"TableFullScan",
"table":"test\/ds\/web_sales"
"table":"test\/ds\/catalog_sales"
},
{
"op_name":"TableFullScan",
"table":"test\/ds\/web_returns"
"table":"test\/ds\/catalog_returns"
}
]
},
Expand Down
56 changes: 28 additions & 28 deletions ydb/core/kqp/ut/join/data/join_order/tpch2_1000s.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,75 +8,75 @@
[
{
"op_name":"TableFullScan",
"table":"part"
"table":"partsupp"
},
{
"op_name":"InnerJoin (MapJoin)",
"args":
[
{
"op_name":"TableFullScan",
"table":"supplier"
},
{
"op_name":"InnerJoin (MapJoin)",
"args":
[
{
"op_name":"InnerJoin (Grace)",
"args":
[
{
"op_name":"TableFullScan",
"table":"partsupp"
},
{
"op_name":"TableFullScan",
"table":"supplier"
}
]
"op_name":"TableLookup",
"table":"region"
},
{
"op_name":"TableFullScan",
"table":"nation"
}
]
},
{
"op_name":"TableFullScan",
"table":"region"
}
]
}
]
},
{
"op_name":"InnerJoin (MapJoin)",
"op_name":"InnerJoin (Grace)",
"args":
[
{
"op_name":"InnerJoin (MapJoin)",
"op_name":"InnerJoin (Grace)",
"args":
[
{
"op_name":"InnerJoin (Grace)",
"op_name":"TableFullScan",
"table":"partsupp"
},
{
"op_name":"InnerJoin (MapJoin)",
"args":
[
{
"op_name":"TableFullScan",
"table":"partsupp"
"table":"supplier"
},
{
"op_name":"TableFullScan",
"table":"supplier"
"op_name":"InnerJoin (MapJoin)",
"args":
[
{
"op_name":"TableLookup",
"table":"region"
},
{
"op_name":"TableFullScan",
"table":"nation"
}
]
}
]
},
{
"op_name":"TableFullScan",
"table":"nation"
}
]
},
{
"op_name":"TableFullScan",
"table":"region"
"table":"part"
}
]
}
Expand Down
Loading
Loading