Description
When I run the following test in SqlToRelConverterTest.java:
@Test void testIntersectWithNulls() { final String sql = "" + "select deptno from\n" + "(select deptno from dept\n" + "union all\n" + "select deptno from emp order by deptno) as alia"; final RelNode rel = tester.convertSqlToRel(sql).rel; System.out.println(RelOptUtil.toString(rel)); }
The RelNode is:
LogicalProject(DEPTNO=[$0])
LogicalUnion(all=[true])
LogicalProject(DEPTNO=[$0])
LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
LogicalProject(DEPTNO=[$7])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
I also tried INTERSECT and EXCEPT, which they all lost ORDER BY operator.
Attachments
Issue Links
- relates to
-
CALCITE-2798 Optimizer should remove ORDER BY in sub-query, provided it has no LIMIT or OFFSET
- Closed
-
CALCITE-4160 Add configuration to retain ORDER BY in sub-query
- Closed