mihaibudiu commented on code in PR #4733:
URL: https://github.com/apache/calcite/pull/4733#discussion_r2688375690


##########
core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml:
##########
@@ -1892,15 +1892,15 @@ LogicalTableModify(table=[[CATALOG, SALES, EMP]], 
operation=[DELETE], flattened=
   </TestCase>
   <TestCase name="testDistinctOrderByRand">
     <Resource name="sql">
-      <![CDATA[select distinct deptno, empno, 1, 'a' from emp order by rand(), 
1]]>
+      <![CDATA[select distinct deptno, deptno, empno, 1, 'a' from emp order by 
rand(), 1]]>
     </Resource>
     <Resource name="plan">
       <![CDATA[
-LogicalProject(DEPTNO=[$0], EMPNO=[$1], EXPR$2=[$2], EXPR$3=[$3])
-  LogicalSort(sort0=[$4], sort1=[$0], dir0=[ASC], dir1=[ASC])
-    LogicalProject(DEPTNO=[$0], EMPNO=[$1], EXPR$2=[$2], EXPR$3=[$3], 
EXPR$4=[RAND()])
+LogicalProject(DEPTNO=[$0], DEPTNO1=[$1], EMPNO=[$2], EXPR$2=[$3], EXPR$3=[$4])
+  LogicalSort(sort0=[$5], sort1=[$0], dir0=[ASC], dir1=[ASC])
+    LogicalProject(DEPTNO=[$0], DEPTNO0=[$0], EMPNO=[$1], EXPR$3=[$2], 
EXPR$4=[$3], EXPR$5=[RAND()])

Review Comment:
   1) Can a plan like this work?
   ```
   LogicalProject(DEPTNO=[$0], DEPTNO1=[$0], EMPNO=[$2], EXPR$2=[$3], 
EXPR$3=[$4])
     LogicalSort(sort0=[$4], sort1=[$0], dir0=[ASC], dir1=[ASC])
       LogicalProject(DEPTNO=[$0], EMPNO=[$1], EXPR$3=[$2], EXPR$4=[$3], 
EXPR$5=[RAND()]
   ```
   2) If this plan is equivalent, why can't your rewrite produce it?



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to