Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.27.0
Description
When SUM data type derivation is more complex, e.g.:
SUM(TINYINT | SMALLINT | INTEGER) -> BIGINT SUM(BIGINT) -> DECIMAL
The rule AggregateExpandDistinctAggregatesRule creates the top aggregate calls with invalid type for not distinct calls.
e.g. SELECT SUM(comm), SUM(DISTINCT comm) FROM emp
Please take a look at the reproducer in the PR.
Proposed fix: infer type of top aggregates by input row type. Pass null type to the call method AggregateCall#create.
Attachments
Issue Links
- relates to
-
CALCITE-4652 AggregateExpandDistinctAggregatesRule must cast top aggregates to original type
- Closed
- links to