[ 
https://issues.apache.org/jira/browse/CALCITE-6440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17861027#comment-17861027
 ] 

Julian Hyde commented on CALCITE-6440:
--------------------------------------

* Your PR uses that word 'empty' again
* Don't worry about removing the unused column in the Project; field trimming 
is not a job easily done by planner rules
* Yes, it should (must) be done in SortRemoveConstantKeysRule. It just needs to 
remove any sort keys that are constant. If the sort has 0 keys after that 
process, then the sort can be removed (unless it has fetch/limit).
* After this change, we should be able to simplify "SELECT * FROM emp ORDER BY 
deptno, null, empno" to "SELECT * FROM emp ORDER BY deptno, empno" and your 
change currently doesn't do that or test that.

> SortRemoveConstantKeysRule should remove NULL literal sort keys (e.g. ORDER 
> BY NULL)
> ------------------------------------------------------------------------------------
>
>                 Key: CALCITE-6440
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6440
>             Project: Calcite
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 1.37.0
>            Reporter: Caican Cai
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.38.0
>
>
> For the following SQL:
> {code:java}
> select * from task order by null; {code}
> We could rewrite it to:
> {code:java}
>  select * from task;{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to