Skip to content

Commit 0531706

Browse files
authored
[yql] Don't fuse FlatMap with outer dependencies with inner grouping op (#5767)
1 parent 6216d63 commit 0531706

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

ydb/library/yql/core/common_opt/yql_co_flow1.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -1404,12 +1404,14 @@ TExprNode::TPtr OptimizeFlatMap(const TExprNode::TPtr& node, TExprContext& ctx,
14041404
}
14051405
}
14061406

1407-
if (node->Head().IsCallable({"GroupByKey", "CombineByKey"})) {
1408-
return FuseFlatMapOverByKey<false>(*node, ctx);
1409-
}
1407+
if (self.Lambda().Ref().IsComplete()) {
1408+
if (node->Head().IsCallable({"GroupByKey", "CombineByKey"})) {
1409+
return FuseFlatMapOverByKey<false>(*node, ctx);
1410+
}
14101411

1411-
if (node->Head().IsCallable({"PartitionByKey", "PartitionsByKeys"})) {
1412-
return FuseFlatMapOverByKey<true>(*node, ctx);
1412+
if (node->Head().IsCallable({"PartitionByKey", "PartitionsByKeys"})) {
1413+
return FuseFlatMapOverByKey<true>(*node, ctx);
1414+
}
14131415
}
14141416

14151417
if (node->Head().IsCallable("ForwardList")) {

ydb/library/yql/tests/s-expressions/yt_native_file/part2/canondata/result.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,9 @@
462462
],
463463
"test.test[Builtins-CombineByKey-Debug]": [
464464
{
465-
"checksum": "e730db3e33eab6087d81bf025ad77153",
466-
"size": 1609,
467-
"uri": "https://{canondata_backend}/1925842/10082a9422a4aa36d413e7a0729f64ea52764084/resource.tar.gz#test.test_Builtins-CombineByKey-Debug_/opt.yql"
465+
"checksum": "1e7fb9d33dfbb7f4f52493ce77bfde0e",
466+
"size": 1687,
467+
"uri": "https://{canondata_backend}/1784117/190d0b39c848aa0cee8a7d16e5c054f8e0c367a6/resource.tar.gz#test.test_Builtins-CombineByKey-Debug_/opt.yql"
468468
},
469469
{
470470
"checksum": "99a23a80241cdd0057583910f9155f61",

0 commit comments

Comments
 (0)