Caican Cai created CALCITE-6272: ----------------------------------- Summary: Improved LogicalPlan representation of distinct keyword Key: CALCITE-6272 URL: https://issues.apache.org/jira/browse/CALCITE-6272 Project: Calcite Issue Type: Improvement Components: core Affects Versions: 1.36.0 Reporter: Caican Cai Fix For: 1.37.0
In the ToLogicalConvert test, the LogicalPlan parsed with or without the distinct keyword is the same. I think this is an improvement. {code:java} @Test void testdistnct() { // Equivalent SQL: // SELECT DISTINCT * // FROM emp final RelBuilder builder = builder(); final RelNode rel = builder.scan("EMP") .distinct() .build(); String expectedPhysical = "" + "EnumerableTableScan(table=[[scott, EMP]])\n"; String expectedLogical = "" + "LogicalTableScan(table=[[scott, EMP]])\n"; verify(rel, expectedPhysical, expectedLogical); } @Test void test() { // Equivalent SQL: // SELECT DISTINCT * // FROM emp final RelBuilder builder = builder(); final RelNode rel = builder.scan("EMP") .build(); String expectedPhysical = "" + "EnumerableTableScan(table=[[scott, EMP]])\n"; String expectedLogical = "" + "LogicalTableScan(table=[[scott, EMP]])\n"; verify(rel, expectedPhysical, expectedLogical); } {code} I think it can be improved to something like {code:java} Logical Project +- Logical Scan (Table: employees){code} -- This message was sent by Atlassian Jira (v8.20.10#820010)