hsyuan commented on a change in pull request #912: [CALCITE-2729] introducing 
WindowReduceExpressionsRule
URL: https://github.com/apache/calcite/pull/912#discussion_r269400172
 
 

 ##########
 File path: core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
 ##########
 @@ -8674,4 +8674,32 @@ LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], 
MGR=[$3], HIREDATE=[$4], SAL=[$
             <![CDATA[select * from emp where MGR > 0 and case when MGR > 0 
then deptno / MGR else null end > 1]]>
         </Resource>
     </TestCase>
+    <TestCase name="testReduceConstantsWindow">
+        <Resource name="sql">
+            <![CDATA[select col1, col2, col3
+from (
+  select empno,
+    sum(100) over (partition by deptno, sal order by sal) as col1,
+    sum(100) over (partition by deptno order by deptno) as col2,
+    sum(sal) over (partition by deptno order by sal) as col3
+  from emp where sal = 5000)
+]]>
+        </Resource>
+        <Resource name="planAfter">
+            <![CDATA[
+LogicalProject($0=[$2], $1=[$3], $2=[$4])
+  LogicalWindow(window#0=[window(partition {1} order by [] range between 
UNBOUNDED PRECEDING and CURRENT ROW aggs [SUM($2)])], 
window#1=[window(partition {} order by [1] range between UNBOUNDED PRECEDING 
and CURRENT ROW aggs [SUM($2)])], window#2=[window(partition {1} order by [] 
range between UNBOUNDED PRECEDING and CURRENT ROW aggs [SUM(5000)])])
 
 Review comment:
   Why it is SUM($2)?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to