[ 
https://issues.apache.org/jira/browse/IGNITE-21897?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrey Mashenkov updated IGNITE-21897:
--------------------------------------
    Labels: calcite2-required ignite-3  (was: ignite-3)

> Sql. Invalid collation passthrough for sorted aggregates.
> ---------------------------------------------------------
>
>                 Key: IGNITE-21897
>                 URL: https://issues.apache.org/jira/browse/IGNITE-21897
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Andrey Mashenkov
>            Assignee: Andrey Mashenkov
>            Priority: Minor
>              Labels: calcite2-required, ignite-3
>             Fix For: 3.0.0-beta2
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> `IgniteSortAggregateBase.passThroughCollation` returns wrong collation in 
> some cases.
> This results in bad plan, e.g. the next query has unexpected Exchanges for 
> Distribution.SINGLE.
> {code:java}
> SELECT COUNT(val0), COUNT(DISTINCT(val1)) from test
> {code}
> The test `MapReduceSortAggregatePlannerTest.countDistinctGroupSetSingle` 
> returns plan: 
> {noformat}
> Project(EXPR$0=[CAST($0):BIGINT NOT NULL], EXPR$1=[$1])
>   Project(EXPR$0=[$0], EXPR$1=[CAST($1):BIGINT NOT NULL])
>     ReduceSortAggregate(group=[{}], EXPR$0=[$SUM0($0)], 
> COUNT_1_MAP_SUM=[$SUM0($1)], collation=[[]])
>       MapSortAggregate(group=[{}], EXPR$0=[$SUM0($1)], EXPR$1=[COUNT($0)], 
> collation=[[]])
>         Project(VAL1=[$0], EXPR$0=[CAST($1):BIGINT NOT NULL])
>           ReduceSortAggregate(group=[{0}], COUNT_1_MAP_SUM=[$SUM0($1)], 
> collation=[[0]])
>             Exchange(distribution=[single])
>               MapSortAggregate(group=[{1}], EXPR$0=[COUNT($0)], 
> collation=[[1]])
>                 Sort(sort0=[$1], dir0=[ASC])
>                   Exchange(distribution=[random])
>                     TableScan(table=[[PUBLIC, TEST]], requiredColumns=[{1, 
> 2}])
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to