my7ym commented on a change in pull request #1152: [CALCITE-2962] 
RelStructuredTypeFlattener generates wrong types for n…
URL: https://github.com/apache/calcite/pull/1152#discussion_r275004974
 
 

 ##########
 File path: 
core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
 ##########
 @@ -867,6 +867,17 @@ LogicalProject(ZIP=[$4])
   LogicalFilter(condition=[=($3, 'abc':VARCHAR(20))])
     LogicalProject(EMPNO=[$0], STREET=[$1.STREET], CITY=[$1.CITY], 
ZIP=[$1.ZIP], STATE=[$1.STATE], STREET5=[$2.STREET], CITY6=[$2.CITY], 
ZIP7=[$2.ZIP], STATE8=[$2.STATE])
       LogicalTableScan(table=[[CATALOG, SALES, EMP_ADDRESS]])
+]]>
+        </Resource>
+    </TestCase>
+    <TestCase name="testSelectNestedColumnType">
+        <Resource name="plan">
+            <![CDATA[
+LogicalProject(COORD=[$0])
 
 Review comment:
   Appreciate your detailed review @zabetak and I was confused too. 
   
   It was because the test utility converts the SqlNode to RelNode on this line
   
https://github.com/apache/calcite/blob/ebafff1ede5921901b322872693bf1dbdf09fc8d/core/src/test/java/org/apache/calcite/test/SqlToRelTestBase.java#L723
   
   And routes to 
   
https://github.com/apache/calcite/blob/3fa29455664bec0056c436491b369e0cd72242ea/core/src/main/java/org/apache/calcite/rel/RelRoot.java#L149
   
   In this function, the original top level project
   ```
   LogicalProject(COORD=[$4], COORD1=[$5], COORD2=[$6])
   ```
   is identified as not trivial and RelRoot creates an extra layer of Project 
on top of it.
   
   This behavior should be in codebase for a long time and orthogonal with my 
fix. And I am wondering what's the original intention to PROJECT a root. (When 
I am using RelRoot, I just RelRoot.rel to get the relation).

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