Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
Description
Consider case like this:
String sql = "select \n" + " gender, \n" + " count(*) \n" + "from \n" + "(\n" + " (select gender, empno from EMPS) \n" + " union \n" + " (select gender, empno from EMPS)\n" + ") group by gender";
And the plan is:
EnumerableAggregate(group=[{0}], EXPR$1=[COUNT()])
EnumerableUnion(all=[false])
EnumerableProject(GENDER=[$3])
EnumerableTableScan(table=[[SALES, EMPS]])
EnumerableProject(GENDER=[$3])
EnumerableTableScan(table=[[SALES, EMPS]])
The col empno has been trimmed, this changes the semantics cuz union will distinct values.
Attachments
Issue Links
- duplicates
-
CALCITE-3399 Field-pruning for set operators (except UNION ALL) changes query semantics
- Closed