You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by "Babulal (JIRA)" <ji...@apache.org> on 2018/05/28 16:22:00 UTC

[jira] [Created] (CARBONDATA-2551) [MV] Query failed when MV Datamap created with Expression in Aggregate

Babulal created CARBONDATA-2551:
-----------------------------------

             Summary: [MV] Query failed when MV Datamap created with Expression in Aggregate
                 Key: CARBONDATA-2551
                 URL: https://issues.apache.org/jira/browse/CARBONDATA-2551
             Project: CarbonData
          Issue Type: Bug
            Reporter: Babulal


CREATE TABLE IF NOT EXISTS babu2 (
 month smallint,
 code string ,
 country smallint,
 salary double , 
 unit smallint,
 b_country smallint,
 imei smallint,
 year smallint) 
STORED BY 'org.apache.carbondata.format' TBLPROPERTIES('SORT_SCOPE'='GLOBAL_SORT','table_blocksize'='256','sort_columns'='year,imei,country,b_country,code,month,unit');

 

insert into babu2 select 12,12,12,12,12,11,12,14;

0: jdbc:hive2://10.18.222.231:23040> create datamap agr21 using 'mv' as select unit,year,country,b_country,sum(case when imei=1 and (year=2015 )then salary else 0 end) v2015ex from babu2 group by unit,year,country,b_country;
+---------+--+
| Result |
+---------+--+
+---------+--+
No rows selected (0.399 seconds)
0: jdbc:hive2://10.18.222.231:23040> rebuild datamap agr21;
+---------+--+
| Result |
+---------+--+
+---------+--+
No rows selected (12.643 seconds)

0: jdbc:hive2://10.18.222.231:23040> create datamap agr22 using 'mv' as select unit,year,country,b_country,sum(salary) from babu2 group by unit,year,country,b_country;
+---------+--+
| Result |
+---------+--+
+---------+--+
No rows selected (0.429 seconds)
0: jdbc:hive2://10.18.222.231:23040> rebuild datamap agr22;
+---------+--+
| Result |
+---------+--+
+---------+--+
No rows selected (12.318 seconds)

0: jdbc:hive2://10.18.222.231:23040> explain select unit,year,country,b_country,sum(salary) from babu2 group by unit,year,country,b_country;
Error: org.apache.spark.sql.AnalysisException: cannot resolve '`babu2.salary`' given input columns: [b_country, year, unit, v2015ex, country]; line 1 pos 132;
'Project [UDF:preAgg() AS preAgg#4106, unit#3857, year#3860, country#3855, b_country#3858, 'sum('babu2.salary) AS sum(salary)#4107]
+- SubqueryAlias gen_subsumer_0
 +- Aggregate [unit#3857, year#3860, country#3855, b_country#3858], [unit#3857, year#3860, country#3855, b_country#3858, sum(CASE WHEN ((cast(imei#3859 as int) = 1) && (cast(year#3860 as int) = 2015)) THEN salary#3856 ELSE 0.0 END) AS v2015ex#4105]
 +- SubqueryAlias babu2
 +- Relation[month#3853,code#3854,country#3855,salary#3856,unit#3857,b_country#3858,imei#3859,year#3860] CarbonDatasourceHadoopRelation [ Database name :default, Table name :babu2, Schema :Some(StructType(StructField(month,ShortType,true), StructField(code,StringType,true), StructField(country,ShortType,true), StructField(salary,DoubleType,true), StructField(unit,ShortType,true), StructField(b_country,ShortType,true), StructField(imei,ShortType,true), StructField(year,ShortType,true))) ] (state=,code=0)

 

 

0: jdbc:hive2://10.18.222.231:23040> desc agr21_table;
+------------------+------------+----------+--+
| col_name | data_type | comment |
+------------------+------------+----------+--+
| babu2_unit | smallint | NULL |
| babu2_year | smallint | NULL |
| babu2_country | smallint | NULL |
| babu2_b_country | smallint | NULL |
| v2015ex | double | NULL |
+------------------+------------+----------+--+
5 rows selected (0.059 seconds)

 

BLR1000023613:/srv/spark2.2Bigdata/sparkJdbc # hadoop fs -cat /user/hive/warehouse/carbon.store/_system/agr21.dmschema
18/05/29 00:19:05 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
{"dataMapName":"agr21","providerName":"mv","relationIdentifier":\{"databaseName":"default","tableName":"agr21_table","tableId":""},"ctasQuery":" select unit,year,country,b_country,sum(case when imei\u003d1 and (year\u003d2015 )then salary else 0 end) v2015ex from babu2 group by unit,year,country,b_country","properties":\{"_internal.deferred.rebuild":"false"},"parentTables":[\{"databaseName":"default","tableName":"babu2","tableId":""}]}BLR1000023613:/srv/spark2.2Bigdata/sparkJdbc #



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