This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new b3e72047df5 [fix](nereids)window expression's window frame may lost in 
NormalizeToSlot (#30378)
b3e72047df5 is described below

commit b3e72047df57ade4f80a502e2e0d1456fb254161
Author: starocean999 <[email protected]>
AuthorDate: Mon Jan 29 16:45:35 2024 +0800

    [fix](nereids)window expression's window frame may lost in NormalizeToSlot 
(#30378)
---
 .../java/org/apache/doris/nereids/rules/rewrite/NormalizeToSlot.java | 3 +++
 .../suites/nereids_p0/aggregate/agg_window_project.groovy            | 5 +++++
 2 files changed, 8 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NormalizeToSlot.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NormalizeToSlot.java
index 1cd56ad1298..efad94c665d 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NormalizeToSlot.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NormalizeToSlot.java
@@ -185,6 +185,9 @@ public interface NormalizeToSlot {
                 }
                 newChildren.add(newChild);
             }
+            if (windowExpression.getWindowFrame().isPresent()) {
+                newChildren.add(windowExpression.getWindowFrame().get());
+            }
             return hasNewChildren ? windowExpression.withChildren(newChildren) 
: windowExpression;
         }
     }
diff --git 
a/regression-test/suites/nereids_p0/aggregate/agg_window_project.groovy 
b/regression-test/suites/nereids_p0/aggregate/agg_window_project.groovy
index 605f4da5ffd..0c9ea9d9fde 100644
--- a/regression-test/suites/nereids_p0/aggregate/agg_window_project.groovy
+++ b/regression-test/suites/nereids_p0/aggregate/agg_window_project.groovy
@@ -96,5 +96,10 @@ suite("agg_window_project") {
 
     order_qt_select4 """select a, c, sum(sum(b)) over(partition by c order by 
c rows between unbounded preceding and current row) from test_window_table2 
group by a, c having a > 1;"""
 
+    explain {
+        sql("select a, c, sum(sum(b)) over(partition by c order by c rows 
between unbounded preceding and current row) from test_window_table2 group by 
a, c having a > 1;")
+        contains "ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW"
+    }
+
     sql "DROP TABLE IF EXISTS test_window_table2;"
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to