@@ -62,7 +62,7 @@ TMaybeNode<TCoMux> ConvertMuxArgumentsToFlows(TCoMux node, TExprContext& ctx) {
62
62
if (child.Maybe <TDqConnection>().IsValid ()) {
63
63
muxArgs.push_back (child);
64
64
}
65
- else if (IsDqPureExpr (child)) {
65
+ else if (IsDqCompletePureExpr (child)) {
66
66
muxArgs.push_back (Build<TCoToFlow>(ctx, node.Pos ())
67
67
.Input (child)
68
68
.Done ());
@@ -242,9 +242,9 @@ TExprBase DqBuildPartitionsStageStub(TExprBase node, TExprContext& ctx, IOptimiz
242
242
}
243
243
244
244
auto partition = node.Cast <TPartition>();
245
- if (!IsDqPureExpr (partition.KeySelectorLambda ()) ||
246
- !IsDqPureExpr (partition.ListHandlerLambda ()) ||
247
- !IsDqPureExpr (partition.SortKeySelectorLambda ()))
245
+ if (!IsDqCompletePureExpr (partition.KeySelectorLambda ()) ||
246
+ !IsDqCompletePureExpr (partition.ListHandlerLambda ()) ||
247
+ !IsDqCompletePureExpr (partition.SortKeySelectorLambda ()))
248
248
{
249
249
return node;
250
250
}
@@ -710,11 +710,7 @@ TExprBase DqBuildPureFlatmapStage(TExprBase node, TExprContext& ctx) {
710
710
711
711
auto flatmap = node.Cast <TCoFlatMapBase>();
712
712
713
- if (!IsDqPureExpr (flatmap.Input ())) {
714
- return node;
715
- }
716
-
717
- if (!IsDqSelfContainedExpr (flatmap.Input ())) {
713
+ if (!IsDqCompletePureExpr (flatmap.Input ()) || !IsDqSelfContainedExpr (flatmap.Lambda ())) {
718
714
return node;
719
715
}
720
716
@@ -757,6 +753,9 @@ TExprBase DqBuildFlatmapStage(TExprBase node, TExprContext& ctx, IOptimizationCo
757
753
}
758
754
759
755
auto flatmap = node.Cast <TCoFlatMapBase>();
756
+ if (!IsDqSelfContainedExpr (flatmap.Lambda ())) {
757
+ return node;
758
+ }
760
759
auto dqUnion = flatmap.Input ().Cast <TDqCnUnionAll>();
761
760
if (!IsSingleConsumerConnection (dqUnion, parentsMap, allowStageMultiUsage)) {
762
761
return node;
@@ -914,7 +913,7 @@ TExprBase DqBuildLMapOverMuxStageStub(TExprBase node, TExprContext& ctx, NYql::I
914
913
return node;
915
914
}
916
915
917
- if (!IsDqPureExpr (lmap.Lambda ())) {
916
+ if (!IsDqCompletePureExpr (lmap.Lambda ())) {
918
917
return node;
919
918
}
920
919
@@ -991,11 +990,11 @@ TExprBase DqPushCombineToStage(TExprBase node, TExprContext& ctx, IOptimizationC
991
990
return node;
992
991
}
993
992
994
- if (!IsDqPureExpr (combine.PreMapLambda ()) ||
995
- !IsDqPureExpr (combine.KeySelectorLambda ()) ||
996
- !IsDqPureExpr (combine.InitHandlerLambda ()) ||
997
- !IsDqPureExpr (combine.UpdateHandlerLambda ()) ||
998
- !IsDqPureExpr (combine.FinishHandlerLambda ()))
993
+ if (!IsDqCompletePureExpr (combine.PreMapLambda ()) ||
994
+ !IsDqCompletePureExpr (combine.KeySelectorLambda ()) ||
995
+ !IsDqCompletePureExpr (combine.InitHandlerLambda ()) ||
996
+ !IsDqCompletePureExpr (combine.UpdateHandlerLambda ()) ||
997
+ !IsDqCompletePureExpr (combine.FinishHandlerLambda ()))
999
998
{
1000
999
return node;
1001
1000
}
@@ -1126,8 +1125,8 @@ TExprBase DqBuildShuffleStage(TExprBase node, TExprContext& ctx, IOptimizationCo
1126
1125
}
1127
1126
1128
1127
auto shuffle = node.Cast <TCoShuffleByKeys>();
1129
- if (!IsDqPureExpr (shuffle.KeySelectorLambda ()) ||
1130
- !IsDqPureExpr (shuffle.ListHandlerLambda ()))
1128
+ if (!IsDqCompletePureExpr (shuffle.KeySelectorLambda ()) ||
1129
+ !IsDqCompletePureExpr (shuffle.ListHandlerLambda ()))
1131
1130
{
1132
1131
return node;
1133
1132
}
@@ -1753,7 +1752,7 @@ TExprBase DqBuildSortStage(TExprBase node, TExprContext& ctx, IOptimizationConte
1753
1752
TVector<const TTypeAnnotationNode*> sortKeyTypes;
1754
1753
1755
1754
auto lambdaBody = sortKeySelector.Body ();
1756
- if (IsDqPureExpr (sortKeySelector)) {
1755
+ if (IsDqCompletePureExpr (sortKeySelector)) {
1757
1756
if (auto maybeColTuple = lambdaBody.Maybe <TExprList>()) {
1758
1757
auto tuple = maybeColTuple.Cast ();
1759
1758
sortKeyTypes.reserve (tuple.Size ());
@@ -1851,7 +1850,7 @@ TExprBase DqBuildSkipStage(TExprBase node, TExprContext& ctx, IOptimizationConte
1851
1850
}
1852
1851
1853
1852
auto skip = node.Cast <TCoSkip>();
1854
- if (!IsDqPureExpr (skip.Count ())) {
1853
+ if (!IsDqCompletePureExpr (skip.Count ())) {
1855
1854
return node;
1856
1855
}
1857
1856
@@ -2087,7 +2086,7 @@ TExprBase DqRewriteLengthOfStageOutput(TExprBase node, TExprContext& ctx, IOptim
2087
2086
}
2088
2087
2089
2088
TExprBase DqBuildPureExprStage (TExprBase node, TExprContext& ctx) {
2090
- if (!IsDqPureExpr (node)) {
2089
+ if (!IsDqCompletePureExpr (node)) {
2091
2090
return node;
2092
2091
}
2093
2092
@@ -2141,7 +2140,7 @@ TExprBase DqBuildExtendStage(TExprBase node, TExprContext& ctx) {
2141
2140
inputConns.push_back (conn);
2142
2141
inputArgs.push_back (programArg);
2143
2142
extendArgs.push_back (programArg);
2144
- } else if (IsDqPureExpr (arg)) {
2143
+ } else if (IsDqCompletePureExpr (arg)) {
2145
2144
// arg is deemed to be a pure expression so leave it inside (Extend ...)
2146
2145
extendArgs.push_back (Build<TCoToFlow>(ctx, arg.Pos ())
2147
2146
.Input (arg)
@@ -2193,7 +2192,7 @@ TExprBase DqBuildPrecompute(TExprBase node, TExprContext& ctx) {
2193
2192
connection = input.Ptr ();
2194
2193
} else if (input.Maybe <TCoParameter>()) {
2195
2194
return input;
2196
- } else if (IsDqPureExpr (input)) {
2195
+ } else if (IsDqCompletePureExpr (input)) {
2197
2196
if (input.Ref ().GetTypeAnn ()->GetKind () != ETypeAnnotationKind::List &&
2198
2197
input.Ref ().GetTypeAnn ()->GetKind () != ETypeAnnotationKind::Data)
2199
2198
{
@@ -2327,7 +2326,7 @@ TExprBase DqBuildSqlIn(TExprBase node, TExprContext& ctx, IOptimizationContext&
2327
2326
return node;
2328
2327
}
2329
2328
2330
- if (!IsDqPureExpr (sqlIn.Lookup ())) {
2329
+ if (!IsDqCompletePureExpr (sqlIn.Lookup ())) {
2331
2330
return node;
2332
2331
}
2333
2332
@@ -2600,7 +2599,7 @@ bool DqValidateJoinInputs(const TExprBase& left, const TExprBase& right, const T
2600
2599
if (!IsSingleConsumerConnection (right.Cast <TDqCnUnionAll>(), parentsMap, allowStageMultiUsage)) {
2601
2600
return false ;
2602
2601
}
2603
- } else if (IsDqPureExpr (right, /* isPrecomputePure */ true )) {
2602
+ } else if (IsDqCompletePureExpr (right, /* isPrecomputePure */ true )) {
2604
2603
// pass
2605
2604
} else {
2606
2605
return false ;
@@ -2674,8 +2673,8 @@ TExprBase DqBuildJoin(const TExprBase& node, TExprContext& ctx, IOptimizationCon
2674
2673
}
2675
2674
2676
2675
bool useHashJoin = EHashJoinMode::Off != hashJoin
2677
- && joinType != " Cross" sv
2678
- && leftIsUnionAll
2676
+ && joinType != " Cross" sv
2677
+ && leftIsUnionAll
2679
2678
&& rightIsUnionAll;
2680
2679
2681
2680
if (DqValidateJoinInputs (join.LeftInput (), join.RightInput (), parentsMap, allowStageMultiUsage)) {
0 commit comments