helloppx commented on a change in pull request #1680: [CALCITE-3621] Push down 
sort to DB, SQL of Sort rel contains explicit field name instead of * when sort 
is not top rel
URL: https://github.com/apache/calcite/pull/1680#discussion_r361360850
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java
 ##########
 @@ -634,6 +634,13 @@ public Result visit(Sort e) {
     }
     Result x = visitChild(0, e.getInput());
     Builder builder = x.builder(e, Clause.ORDER_BY);
+    if (builder.select.getSelectList() == null) {
 
 Review comment:
   I have updated the description of regission issue again, please help review 
:D
   
   `if (stack.getLast().r != e)` can make a decision whether currently Sort rel 
is the outermost rel.
   If it is, the select list of generated SQL can be "select *", It is more 
simplier.
   If not, the select list of generated SQL shoud contain explicit column name.
   
   Yes, `CalcitePrepareImpl#implement(RelRoot root)` generate SQL by 
`root.rel`,but the correctly select field be controled by `root.fields`.
   
   

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