chunweilei commented on a change in pull request #713: [CALCITE-2343] Fix 
infinite loop caused by PushProjector
URL: https://github.com/apache/calcite/pull/713#discussion_r275123537
 
 

 ##########
 File path: core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
 ##########
 @@ -1367,6 +1367,29 @@ LogicalProject(EXPR$0=[+($1, $4)])
       LogicalTableScan(table=[[CATALOG, SALES, EMP]])
     LogicalProject(ENAME=[$0], COMM=[$3])
       LogicalTableScan(table=[[CATALOG, SALES, BONUS]])
+]]>
+        </Resource>
+    </TestCase>
+    <TestCase name="testPushProjectWithOverPastJoin">
+        <Resource name="sql">
+            <![CDATA[select e.sal + b.comm, count(e.empno) over() from emp e 
inner join bonus b on e.ename = b.ename and e.deptno = 10]]>
+        </Resource>
+        <Resource name="planBefore">
+            <![CDATA[
+LogicalProject(EXPR$0=[+($5, $12)], EXPR$1=[COUNT($0) OVER (RANGE BETWEEN 
UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)])
+  LogicalJoin(condition=[AND(=($1, $9), =($7, 10))], joinType=[inner])
+    LogicalTableScan(table=[[CATALOG, SALES, EMP]])
+    LogicalTableScan(table=[[CATALOG, SALES, BONUS]])
+]]>
+        </Resource>
+        <Resource name="planAfter">
+            <![CDATA[
+LogicalProject(EXPR$0=[+($1, $5)], EXPR$1=[$2])
+  LogicalJoin(condition=[AND(=($0, $4), $3)], joinType=[inner])
+    LogicalProject(ENAME=[$1], SAL=[$5], COUNT=[COUNT($0) OVER (RANGE BETWEEN 
UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)], ==[=($7, 10)])
 
 Review comment:
   > OVER must not be pushed into Join since it might affect return value
   Agree with it. In this test case, obviously OVER should not be pushed into 
join since join will eliminate some values.

----------------------------------------------------------------
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