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

Ajantha Bhat resolved CARBONDATA-3752.
--------------------------------------
    Fix Version/s: 2.0.0
       Resolution: Fixed

> Query on carbon table should support reusing Exchange
> -----------------------------------------------------
>
>                 Key: CARBONDATA-3752
>                 URL: https://issues.apache.org/jira/browse/CARBONDATA-3752
>             Project: CarbonData
>          Issue Type: Improvement
>            Reporter: David Cai
>            Priority: Major
>             Fix For: 2.0.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Query on carbon table should support reusing Exchange
> [Reproduce]
> create table t1(c1 int, c2 string) using carbondata
> insert into t1 values(1, 'abc')
> explain
>  select c2, sum(c1) from t1 group by c2
>  union all
>  select c2, sum(c1) from t1 group by c2
> [Physical Plan]
> {noformat}
> Union
> :- *(2) HashAggregate(keys=[c2#37], functions=[sum(cast(c1#36 as bigint))])
> : +- Exchange hashpartitioning(c2#37, 200)
> : +- *(1) HashAggregate(keys=[c2#37], functions=[partial_sum(cast(c1#36 as 
> bigint))])
> : +- *(1) FileScan carbondata default.t1[c1#36,c2#37] ReadSchema: 
> struct<c1:int,c2:string>
> +- *(4) HashAggregate(keys=[c2#37], functions=[sum(cast(c1#36 as bigint))])
>  +- Exchange hashpartitioning(c2#37, 200)
>  +- *(3) HashAggregate(keys=[c2#37], functions=[partial_sum(cast(c1#36 as 
> bigint))])
>  +- *(3) FileScan carbondata default.t1[c1#36,c2#37] ReadSchema: 
> struct<c1:int,c2:string>{noformat}
> It should reuse Exchange like Following:
> {noformat}
> Union
> :- *(2) HashAggregate(keys=[c2#37], functions=[sum(cast(c1#36 as bigint))])
> :  +- Exchange hashpartitioning(c2#37, 200)
> :     +- *(1) HashAggregate(keys=[c2#37], functions=[partial_sum(cast(c1#36 
> as bigint))])
> :        +- *(1) FileScan carbondata default.t1[c1#36,c2#37] ReadSchema: 
> struct<c1:int,c2:string>
> +- *(4) HashAggregate(keys=[c2#37], functions=[sum(cast(c1#36 as bigint))])
>    +- ReusedExchange [c2#37, sum#54L], Exchange hashpartitioning(c2#37, 
> 200){noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to