Skip to content

Commit 0ad5074

Browse files
authored
[DQ] Fix DqUnorderedOverStageInput optimizer (#9456)
1 parent de1fcdc commit 0ad5074

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ydb/library/yql/dq/opt/dq_opt_phy.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3047,15 +3047,21 @@ TMaybeNode<TExprBase> DqUnorderedOverStageInput(TExprBase node, TExprContext& ct
30473047
return node;
30483048
}
30493049

3050+
bool withConnections = false;
30503051
for (size_t i = 0; i < stage.Inputs().Size(); ++i) {
30513052
if (inputsToOptimize.Test(i)) {
30523053
if (auto conn = stage.Inputs().Item(i).Maybe<TDqConnection>()) {
30533054
if (!IsSingleConsumerConnection(conn.Cast(), parentsMap, allowStageMultiUsage)) {
30543055
return node;
30553056
}
3057+
withConnections = true;
30563058
}
30573059
}
30583060
}
3061+
// Stage input section may be reused multiple times
3062+
if (withConnections && !IsSingleConsumer(stage.Inputs(), parentsMap)) {
3063+
return node;
3064+
}
30593065

30603066
TExprNode::TPtr newStageLambda;
30613067
auto status = RemapExpr(stageLambda.Ptr(), newStageLambda, nodesToOptimize, ctx, TOptimizeExprSettings{nullptr});

0 commit comments

Comments
 (0)