You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Vladimir Ozerov (Jira)" <ji...@apache.org> on 2021/05/25 18:20:00 UTC

[jira] [Commented] (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=17351269#comment-17351269 ] 

Vladimir Ozerov commented on CALCITE-4616:
------------------------------------------

The proposed fix:
# Iterate over all inputs and check if they require aggregate pushdown.
# If no inputs require the pushdown, return.
# If at least one input requires a pushdown, do a pushdown for all other inputs as well. 
# This way we ensure that all inputs would have the same row type, and the problem would go away. The {{AggregateRemoveRule}} may remove the unnecessary aggregates afterward.

> 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
>    Affects Versions: 1.26.0
>            Reporter: Vladimir Ozerov
>            Priority: Major
>
> 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:
> 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)