You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Chunwei Lei (Jira)" <ji...@apache.org> on 2021/10/28 02:25:00 UTC
[jira] [Resolved] (CALCITE-4818)
AggregateExpandDistinctAggregatesRule must infer correct data type for top
aggregate calls
[ https://issues.apache.org/jira/browse/CALCITE-4818?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chunwei Lei resolved CALCITE-4818.
----------------------------------
Resolution: Fixed
Fixed in [https://github.com/apache/calcite/commit/3af1d78f7e60588c2497f8e0095d715ab179149a.] Thank you for the PR, [~tledkov-gridgain]!
> AggregateExpandDistinctAggregatesRule must infer correct data type for top aggregate calls
> ------------------------------------------------------------------------------------------
>
> Key: CALCITE-4818
> URL: https://issues.apache.org/jira/browse/CALCITE-4818
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.27.0
> Reporter: Taras Ledkov
> Assignee: Taras Ledkov
> Priority: Major
> Labels: pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> When SUM data type derivation is more complex, e.g.:
> {code}
> SUM(TINYINT | SMALLINT | INTEGER) -> BIGINT
> SUM(BIGINT) -> DECIMAL
> {code}
> 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}}.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)