diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2023-10-23 17:15:02 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2023-10-23 18:01:21 +0300 |
commit | a3f3a35aaee5b3cac5a9d2143fa754a41a82cfa5 (patch) | |
tree | 4cdb78a17c5eb6a87d979926b429ad81f06a6cf0 | |
parent | cb1f1ff293a64febd278ea89e86ccb57c9adfdb3 (diff) | |
download | ydb-a3f3a35aaee5b3cac5a9d2143fa754a41a82cfa5.tar.gz |
YQL-15891 Drop unused fields from wide filter.
-rw-r--r-- | ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp b/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp index 182b04c9a72..5961db14f6a 100644 --- a/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp +++ b/ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp @@ -5585,7 +5585,19 @@ TExprNode::TPtr OptimizeWideMaps(const TExprNode::TPtr& node, TExprContext& ctx) YQL_CLOG(DEBUG, CorePeepHole) << "Swap " << node->Content() << " with " << input.Content(); return ctx.ChangeChild(input, 0U, ctx.ChangeChild(*node, 0U, input.HeadPtr())); } else if (const auto unused = UnusedArgs<1U>({&node->Tail()}); !unused.empty()) { - if (input.IsCallable("WideCombiner")) { + if (input.IsCallable({"WideFilter", "WideSkipWhile", "WideSkipWhileInclusive", "WideTakeWhile", "WideTakeWhileInclusive"})) { + if (const auto actualUnused = UnusedArgs<2U>({&node->Tail(), input.Child(1U)}); !actualUnused.empty()) { + YQL_CLOG(DEBUG, CorePeepHole) << node->Content() << " over " << input.Content() << " with " << actualUnused.size() << " unused fields."; + auto children = input.ChildrenList(); + children.front() = MakeWideMapForDropUnused(std::move(children.front()), actualUnused, ctx); + children[1U] = DropUnusedArgs(*children[1U], actualUnused, ctx); + return ctx.Builder(node->Pos()) + .Callable(node->Content()) + .Add(0, ctx.ChangeChildren(input, std::move(children))) + .Add(1, DropUnusedArgs(node->Tail(), actualUnused, ctx)) + .Seal().Build(); + } + } else if (input.IsCallable("WideCombiner")) { YQL_CLOG(DEBUG, CorePeepHole) << node->Content() << " over " << input.Content() << " with " << unused.size() << " unused fields."; return ctx.Builder(node->Pos()) .Callable(node->Content()) @@ -5618,7 +5630,7 @@ TExprNode::TPtr OptimizeWideMaps(const TExprNode::TPtr& node, TExprContext& ctx) .Add(1, DropUnusedArgs(node->Tail(), actualUnused, ctx)) .Seal().Build(); } - } else if (input.IsCallable({"WideFromBlocks", "WideTakeBlocks", "WideSkipBlocks"})) { + } else if (input.IsCallable({"WideFromBlocks", "WideTakeBlocks", "WideSkipBlocks", "BlockExpandChunked"})) { YQL_CLOG(DEBUG, CorePeepHole) << node->Content() << " over " << input.Content() << " with " << unused.size() << " unused fields."; return ctx.Builder(node->Pos()) .Callable(node->Content()) |