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


##########
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:
   Oh, my understanding of duplicate columns is that they should be excluded in 
the AGG but retained in the PROJECT. To handle the RAND() issue, a PROJECT is 
added above the AGG to be compatible with RAND(). My concern is whether there 
will be other operators above the PROJECT (perhaps FILTER?), and whether those 
other operators will have other PROJECTs, which involves the depth of 
processing. I think I need to verify the original logic again to see what the 
plan with duplicate columns looks like.



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