diff options
author | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-01-16 12:03:36 +0300 |
---|---|---|
committer | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-01-16 12:03:36 +0300 |
commit | 57925e8af0cd20d6bddd073d7f5ab3b35f1ff2a0 (patch) | |
tree | cc45a926c26bf90362fe0e6b60d079f987c47ba3 | |
parent | 36960b67dc27bff69f8597c6f9209a372a3ef02f (diff) | |
download | ydb-57925e8af0cd20d6bddd073d7f5ab3b35f1ff2a0.tar.gz |
improve checker for deduplication
-rw-r--r-- | ydb/library/yql/core/peephole_opt/yql_opt_peephole_physical.cpp | 4 |
1 files changed, 3 insertions, 1 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 e377d1592b1..a967f4b4323 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 @@ -4387,6 +4387,7 @@ using TDedupRealMap = std::map<ui32, ui32>; TDedupRealMap DedupAggregationKeysFromState(const TExprNode& extract, const TExprNode& init, const TExprNode& update) { YQL_ENSURE(init.ChildrenSize() == update.ChildrenSize(), "Must be same size."); const ui32 keyWidth = extract.ChildrenSize() - 1; + const ui32 itemsWidth = extract.Head().ChildrenSize(); TNodeMap<ui32> map; map.reserve(keyWidth); @@ -4405,7 +4406,8 @@ TDedupRealMap DedupAggregationKeysFromState(const TExprNode& extract, const TExp if (!CompareExprTreeParts(*extract.Child(extractIdx), *init.Child(initIdx), map)) { continue; } - if (update.Head().Child(initIdx + keyWidth) != update.Child(initIdx)) { + if (update.Head().Child(initIdx - 1 + keyWidth) != update.Child(initIdx) && + update.Child(initIdx) != update.Head().Child(initIdx + keyWidth + itemsWidth - 1)) { continue; } dedups.emplace(initIdx + keyWidth - 1, extractIdx - 1); |