aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraneporada <aneporada@yandex-team.ru>2022-02-18 16:51:03 +0300
committeraneporada <aneporada@yandex-team.ru>2022-02-18 16:51:03 +0300
commit42d1083f5b8457931cd4d0ca5ec1970097adc310 (patch)
tree4f15ffa80fc4d54eec7d83e43e1f6f494f6763bc
parentedefa564e11987d4aa60fff0a2378785deb03b54 (diff)
downloadydb-42d1083f5b8457931cd4d0ca5ec1970097adc310.tar.gz
[YQL-14425] Make sure CalcOverWindow node is annotated before trying to expand it
ref:383d0350c12cfdb63e1e77efb8d7cc82d8881566
-rw-r--r--ydb/library/yql/dq/opt/dq_opt_log.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/ydb/library/yql/dq/opt/dq_opt_log.cpp b/ydb/library/yql/dq/opt/dq_opt_log.cpp
index fed0f09f0f..2dc4bef15c 100644
--- a/ydb/library/yql/dq/opt/dq_opt_log.cpp
+++ b/ydb/library/yql/dq/opt/dq_opt_log.cpp
@@ -130,9 +130,16 @@ TExprBase DqExpandWindowFunctions(TExprBase node, TExprContext& ctx, bool enforc
if (node.Maybe<TCoCalcOverWindowBase>() || node.Maybe<TCoCalcOverWindowGroup>()) {
if (enforceCompact) {
auto calcs = ExtractCalcsOverWindow(node.Ptr(), ctx);
+ bool changed = false;
for (auto& c : calcs) {
TCoCalcOverWindowTuple win(c);
- node = DqEnforceCompactPartition(node, win.Frames(), ctx);
+ auto enforced = DqEnforceCompactPartition(node, win.Frames(), ctx);
+ changed = changed || (enforced.Raw() != node.Raw());
+ node = enforced;
+ }
+
+ if (changed) {
+ return node;
}
}