Skip to content

Commit 7858de7

Browse files
ssmikeuzhastik
authored andcommitted
Force precompute on returning effect inputs (ydb-platform#10695)
1 parent a7050a6 commit 7858de7

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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,6 +2731,17 @@ TExprBase DqPropagatePrecomuteTake(TExprBase node, TExprContext& ctx, IOptimizat
27312731
return node;
27322732
}
27332733

2734+
auto* typeAnn = precompute.Connection().Raw()->GetTypeAnn();
2735+
2736+
YQL_ENSURE(typeAnn);
2737+
typeAnn = GetSeqItemType(typeAnn);
2738+
if (typeAnn->GetKind() != ETypeAnnotationKind::List &&
2739+
typeAnn->GetKind() != ETypeAnnotationKind::Flow &&
2740+
typeAnn->GetKind() != ETypeAnnotationKind::Stream)
2741+
{
2742+
return node;
2743+
}
2744+
27342745
auto takeLambda = Build<TCoLambda>(ctx, node.Pos())
27352746
.Args({"list_stream"})
27362747
.Body<TCoMap>()

0 commit comments

Comments
 (0)