You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by "Chenjian Qiu (JIRA)" <ji...@apache.org> on 2019/01/17 09:23:00 UTC

[jira] [Created] (CARBONDATA-3256) MV datamap throw error using avg expression and count expression

Chenjian Qiu created CARBONDATA-3256:
----------------------------------------

             Summary: MV datamap throw error using avg expression and count expression
                 Key: CARBONDATA-3256
                 URL: https://issues.apache.org/jira/browse/CARBONDATA-3256
             Project: CarbonData
          Issue Type: Bug
          Components: sql
            Reporter: Chenjian Qiu


test case:
create table test_table(name string, age int, height int,weight int) stored by 'carbondata'
create datamap test_table_mv using 'mv' as select sum(height),count(age),avg(age),name from test_table group by name
explain select avg(age),name from test_table group by name

error:
It is not allowed to use an aggregate function in the argument of another aggregate function. Please use the inner aggregate function in a sub-query.;;
Aggregate [name#267], [(sum((avg(age)#266 * cast(sum(count(age)#265L) as double))) / cast(sum(count(age)#265L) as double)) AS avg(age)#268, name#267]
+- SubqueryAlias gen_subsumer_0
   +- Project [sum_height#208L AS sum(height)#264L, count_age#209L AS count(age)#265L, avg_age#210 AS avg(age)#266, test_table_name#211 AS name#267]
      +- SubqueryAlias test_table_mv_table
         +- Project [sum_height#208L, count_age#209L, avg_age#210, test_table_name#211]
            +- SubqueryAlias test_table_mv_table
               +- Relation[sum_height#208L,count_age#209L,avg_age#210,test_table_name#211] CarbonDatasourceHadoopRelation [ Database name :default, Table name :test_table_mv_table, Schema :Some(StructType(StructField(sum_height,LongType,true), StructField(count_age,LongType,true), StructField(avg_age,DoubleType,true), StructField(test_table_name,StringType,true))) ]




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)