Class SortRemoveDuplicateKeysRule

All Implemented Interfaces:
TransformationRule

@Enclosing public class SortRemoveDuplicateKeysRule extends RelRule<SortRemoveDuplicateKeysRule.Config> implements TransformationRule
Planner rule that remove duplicate sort keys.

The original SQL:


 SELECT d1 FROM (
   SELECT deptno AS d1, deptno AS d2 FROM dept
 ) AS tmp ORDER BY d1, d2
 

The original logical plan:

 LogicalProject(D1=[$0])
   LogicalSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC])
     LogicalProject(D1=[$0], D2=[$0])
       LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
 

After optimization:

 LogicalProject(D1=[$0])
   LogicalProject(DEPTNO=[$0], DEPTNO0=[$0])
     LogicalSort(sort0=[$0], dir0=[ASC])
       LogicalProject(DEPTNO=[$0])
         LogicalTableScan(table=[[CATALOG, SALES, DEPT]])