Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Prune Project's input if project has no RexInputRef and the input has 1 row. The idea is to improve SQL
select 1 from emps group by ()
In this case, we can safely prune the Aggregate. To be more specifically, I'm proposing to match a Project -> Aggregate, and the Project has not field reference from the Aggregate, and the Aggregate's grouping list is empty (which means it will produce 1 row exactly), in this case, we can optimize it to Project -> Values(1) to eliminate the Aggregate.
This idea is brought up in the discussion of CALCITE-5506
We can add this improvement to ProjectAggregateMergeRule.
Attachments
Issue Links
- is related to
-
CALCITE-2946 RelBuilder wrongly skips creation of Aggregate that prunes columns if input produces one row at most
- Closed
-
CALCITE-5506 RelToSqlConverter should retain the aggregation logic when Project without RexInputRef on the Aggregate
- Closed
- links to