> Remove unnecessary Project for CarbonScan
> -----------------------------------------
>
> Key: CARBONDATA-108
> URL:
https://issues.apache.org/jira/browse/CARBONDATA-108> Project: CarbonData
> Issue Type: Improvement
> Components: spark-integration
> Reporter: Jacky Li
> Assignee: Jacky Li
>
> For this SQL:
> select ch, sum(c) from (select ch,count(1) as c from t1 group by ch) temp where c > 1 group by ch
> Physical plan is:
> == Physical Plan ==
> Limit 21
> ConvertToSafe
> CarbonDictionaryDecoder [CarbonDecoderRelation(Map(word#22 -> word#22, ch#23 -> ch#23, value#24L -> value#24L),CarbonDatasourceRelation(`default`.`t1`,None))], ExcludeProfile(ArrayBuffer()), CarbonAliasDecoderRelation()
> TungstenAggregate(key=[ch#23], functions=[(sum(c#18L),mode=Final,isDistinct=false)], output=[ch#23,_c1#25L])
> TungstenAggregate(key=[ch#23], functions=[(sum(c#18L),mode=Partial,isDistinct=false)], output=[ch#23,currentSum#48L])
> Filter (c#18L > 1)
> TungstenAggregate(key=[ch#23], functions=[(count(1),mode=Final,isDistinct=false)], output=[ch#23,c#18L])
> TungstenExchange hashpartitioning(ch#23)
> TungstenAggregate(key=[ch#23], functions=[(count(1),mode=Partial,isDistinct=false)], output=[ch#23,currentCount#52L])
> Project [ch#23]
> ConvertToSafe
> CarbonScan [ch#23], (CarbonRelation default, t1, CarbonMetaData(ArrayBuffer(word, ch),ArrayBuffer(value),org.carbondata.core.carbon.metadata.schema.table.CarbonTable@6034ef16,DictionaryMap(Map(word -> true, ch -> true))), TableMeta(default_t1,/Users/jackylk/code/incubator-carbondata/target/store,org.carbondata.core.carbon.metadata.schema.table.CarbonTable@6034ef16,Partitioner(org.carbondata.spark.partition.api.impl.SampleDataPartitionerImpl,[Ljava.lang.String;@450458d7,1,[Ljava.lang.String;@f8a969d)), None), true
> The Project is unnecessary since CarbonScan only scan the requested column