Skip to content

Commit 7c22bbb

Browse files
authored
Force precompute on returning effect inputs (#10695)
1 parent c3c5c05 commit 7c22bbb

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ydb/core/kqp/opt/physical/effects/kqp_opt_phy_returning.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ TExprBase KqpRewriteReturningUpsert(TExprBase node, TExprContext& ctx, const TKq
204204
return node;
205205
}
206206

207-
if (!upsert.Input().Maybe<TDqPrecompute>() && !upsert.Input().Maybe<TDqPhyPrecompute>()) {
207+
if (upsert.Input().Maybe<TDqPrecompute>() || upsert.Input().Maybe<TDqPhyPrecompute>()) {
208208
return node;
209209
}
210210

@@ -226,7 +226,7 @@ TExprBase KqpRewriteReturningDelete(TExprBase node, TExprContext& ctx, const TKq
226226
return node;
227227
}
228228

229-
if (!del.Input().Maybe<TDqPrecompute>() && !del.Input().Maybe<TDqPhyPrecompute>()) {
229+
if (del.Input().Maybe<TDqPrecompute>() || del.Input().Maybe<TDqPhyPrecompute>()) {
230230
return node;
231231
}
232232

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

+11
Original file line numberDiff line numberDiff line change
@@ -2775,6 +2775,17 @@ TExprBase DqPropagatePrecomuteTake(TExprBase node, TExprContext& ctx, IOptimizat
27752775
return node;
27762776
}
27772777

2778+
auto* typeAnn = precompute.Connection().Raw()->GetTypeAnn();
2779+
2780+
YQL_ENSURE(typeAnn);
2781+
typeAnn = GetSeqItemType(typeAnn);
2782+
if (typeAnn->GetKind() != ETypeAnnotationKind::List &&
2783+
typeAnn->GetKind() != ETypeAnnotationKind::Flow &&
2784+
typeAnn->GetKind() != ETypeAnnotationKind::Stream)
2785+
{
2786+
return node;
2787+
}
2788+
27782789
auto takeLambda = Build<TCoLambda>(ctx, node.Pos())
27792790
.Args({"list_stream"})
27802791
.Body<TCoMap>()

0 commit comments

Comments
 (0)