aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorudovichenko-r <udovichenko-r@yandex-team.ru>2022-03-24 11:11:20 +0300
committerudovichenko-r <udovichenko-r@yandex-team.ru>2022-03-24 11:11:20 +0300
commit6c7158b24a08e281736dee81a9fe98146982d58b (patch)
treef1aa79932ceedd46056ce933811b837ebd8acc16
parent8eb84376d8c1f5faaf0ac0e7eba3e2b3bcbd0ae8 (diff)
downloadydb-6c7158b24a08e281736dee81a9fe98146982d58b.tar.gz
[yql] Fix YQL-14581
ref:fd792a5a69b7c0bcae7fdc1c4fa28cd25744ed52
-rw-r--r--ydb/library/yql/core/common_opt/yql_co_flow1.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/ydb/library/yql/core/common_opt/yql_co_flow1.cpp b/ydb/library/yql/core/common_opt/yql_co_flow1.cpp
index 278f1996b7..af96a0f803 100644
--- a/ydb/library/yql/core/common_opt/yql_co_flow1.cpp
+++ b/ydb/library/yql/core/common_opt/yql_co_flow1.cpp
@@ -66,7 +66,6 @@ TExprNode::TPtr FuseFlatmaps(TCoFlatMapBase outerMap, TExprContext& ctx, TTypeAn
return ctx.WrapByCallableIf(1U == width && outerMap.Ref().GetTypeAnn()->GetKind() == ETypeAnnotationKind::List && innerMap.Input().Ref().GetTypeAnn()->GetKind() == ETypeAnnotationKind::Optional, "ToList", std::move(flatMap));
}
-
if (IsJustOrSingleAsList(innerBody.Ref())) {
auto placeHolder = ctx.NewArgument(outerMap.Pos(), "placeholder");
@@ -81,9 +80,10 @@ TExprNode::TPtr FuseFlatmaps(TCoFlatMapBase outerMap, TExprContext& ctx, TTypeAn
return {};
}
+ auto clonedInnerLambda = TCoLambda(ctx.DeepCopyLambda(innerMap.Lambda().Ref()));
auto outerArgValue = innerBody.template Maybe<TCoJust>()
- ? innerBody.template Cast<TCoJust>().Input()
- : innerBody.template Cast<TCoAsList>().Arg(0);
+ ? clonedInnerLambda.Body().template Cast<TCoJust>().Input()
+ : clonedInnerLambda.Body().template Cast<TCoAsList>().Arg(0);
YQL_CLOG(DEBUG, Core) << "FuseFlatmaps with inner " << innerBody.Ref().Content();
@@ -101,7 +101,7 @@ TExprNode::TPtr FuseFlatmaps(TCoFlatMapBase outerMap, TExprContext& ctx, TTypeAn
.template Input<TExprApplier>()
.Apply(TCoLambda(outerLambda))
.With(0, outerArgValue)
- .With(innerMap.Lambda().Args().Arg(0), "item")
+ .With(clonedInnerLambda.Args().Arg(0), "item")
.template With<TCoDependsOn>(TExprBase(placeHolder))
.Input("item")
.Build()
@@ -121,7 +121,7 @@ TExprNode::TPtr FuseFlatmaps(TCoFlatMapBase outerMap, TExprContext& ctx, TTypeAn
.template Input<TExprApplier>()
.Apply(TCoLambda(outerLambda))
.With(0, outerArgValue)
- .With(innerMap.Lambda().Args().Arg(0), "item")
+ .With(clonedInnerLambda.Args().Arg(0), "item")
.template With<TCoDependsOn>(TExprBase(placeHolder))
.Input("item")
.Build()
@@ -146,7 +146,7 @@ TExprNode::TPtr FuseFlatmaps(TCoFlatMapBase outerMap, TExprContext& ctx, TTypeAn
.template Optional<TExprApplier>()
.Apply(TCoLambda(outerLambda))
.With(0, outerArgValue)
- .With(innerMap.Lambda().Args().Arg(0), "item")
+ .With(clonedInnerLambda.Args().Arg(0), "item")
.template With<TCoDependsOn>(TExprBase(placeHolder))
.Input("item")
.Build()
@@ -164,7 +164,7 @@ TExprNode::TPtr FuseFlatmaps(TCoFlatMapBase outerMap, TExprContext& ctx, TTypeAn
.template Body<TExprApplier>()
.Apply(TCoLambda(outerLambda))
.With(0, outerArgValue)
- .With(innerMap.Lambda().Args().Arg(0), "item")
+ .With(clonedInnerLambda.Args().Arg(0), "item")
.template With<TCoDependsOn>(TExprBase(placeHolder))
.Input("item")
.Build()