You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Rui Wang (Jira)" <ji...@apache.org> on 2021/06/15 19:21:00 UTC
[jira] [Comment Edited] (CALCITE-4616) AggregateUnionTransposeRule
causes row type mismatch when some inputs have unique grouping key
[ https://issues.apache.org/jira/browse/CALCITE-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17363864#comment-17363864 ]
Rui Wang edited comment on CALCITE-4616 at 6/15/21, 7:20 PM:
-------------------------------------------------------------
Ah I see it now: if all inputs on a column has unique key, then having agg on each inputs will work as one input contain a key that other inputs does not have (thus agg on that single input is ok).
However, per the added test case, I am still confused: if we say that all inputs have unique keys thus we push down agg, then why we still need the top agg?
was (Author: amaliujia):
Ah I see it now: if all inputs on a column has unique key, then having agg on each inputs will work as one input contain a key that other inputs does not have (thus agg on that single input is ok).
> AggregateUnionTransposeRule causes row type mismatch when some inputs have unique grouping key
> ----------------------------------------------------------------------------------------------
>
> Key: CALCITE-4616
> URL: https://issues.apache.org/jira/browse/CALCITE-4616
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.26.0
> Reporter: Vladimir Ozerov
> Assignee: Vladimir Ozerov
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.28.0
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Consider the following relational tree:
> {code}
> 1: Aggregate[group=a, SUM(b)]
> 2: Union
> 3: Input1[a, b, c]
> 4: Input2[a, b, c]
> {code}
> It may happen, that {{Input1}} has a unique key on {{[a]}}. In this case, Apache Calcite, will not install the {{Aggregate}} on top of it, which leads to the following tree:
> {code}
> 1: Aggregate[group=a, SUM(b)]
> 2: Union
> 3: Input1[a, b, c]
> 4: Aggregate[group=a, SUM(b)]
> 5: Input2[a, b, c]
> {code}
> Obviously, the tree is incorrect, because {{Union}} inputs now have different row types.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)