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

Zhen Chen commented on CALCITE-7104:
------------------------------------

Thank you very much for [~julianhyde]'s detailed reply. I completely agree with 
this implementation approach. I was previously trying to see if an Md* could be 
used as a utility class to perform equality checks for expressions, but it now 
seems that functional dependency is indeed a more general method. I think the 
current JIRA can be temporarily suspended. Once functional dependency is 
implemented, it will better handle the elimination of duplicate sort keys (and 
may also include a general rule covering SORT, AGG, and some RelNodes with 
column pruning effects). I might need to spend some time first thoroughly 
understanding all the discussions in the JIRAs you provided to see if I can 
attempt to implement CALCITE-5913 first.

> Remove duplicate sort keys
> --------------------------
>
>                 Key: CALCITE-7104
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7104
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: weihua zhang
>            Priority: Major
>              Labels: pull-request-available
>
> {code:sql}
> select d1 from  (select deptno as d1, deptno as d2 from dept ) as tmp order 
> by d1, d2;
> {code}
> {noformat}
> LogicalProject(D1=[$0]), id = 2284
>   LogicalSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC]), id = 2283
>     LogicalProject(D1=[$0], D2=[$0]), id = 2282
>       LogicalTableScan(table=[[default, dept]]), id = 2278
> {noformat}
> LogicalSort can change to:
> {noformat}
> LogicalProject(D1=[$0]), id = 2284
>   LogicalSort(sort0=[$0], dir0=[ASC]), id = 2283
>     LogicalProject(D1=[$0], D2=[$0]), id = 2282
>       LogicalTableScan(table=[[default, dept]]), id = 2278
> {noformat}



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

Reply via email to