[jira] [Updated] (CARBONDATA-1743) Carbon1.3.0-Pre-AggregateTable - Query returns no value if run at the time of pre-aggregate table creation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (CARBONDATA-1743) Carbon1.3.0-Pre-AggregateTable - Query returns no value if run at the time of pre-aggregate table creation

Akash R Nilugal (Jira)

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

Ramakrishna S updated CARBONDATA-1743:
--------------------------------------
    Description:
Steps:
1. Create table and load with large data
create table if not exists lineitem4(L_SHIPDATE string,L_SHIPMODE string,L_SHIPINSTRUCT string,L_RETURNFLAG string,L_RECEIPTDATE string,L_ORDERKEY string,L_PARTKEY string,L_SUPPKEY   string,L_LINENUMBER int,L_QUANTITY double,L_EXTENDEDPRICE double,L_DISCOUNT double,L_TAX double,L_LINESTATUS string,L_COMMITDATE string,L_COMMENT  string) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES ('table_blocksize'='128','NO_INVERTED_INDEX'='L_SHIPDATE,L_SHIPMODE,L_SHIPINSTRUCT,L_RETURNFLAG,L_RECEIPTDATE,L_ORDERKEY,L_PARTKEY,L_SUPPKEY','sort_columns'='');
load data inpath "hdfs://hacluster/user/test/lineitem.tbl.1" into table lineitem4 options('DELIMITER'='|','FILEHEADER'='L_ORDERKEY,L_PARTKEY,L_SUPPKEY,L_LINENUMBER,L_QUANTITY,L_EXTENDEDPRICE,L_DISCOUNT,L_TAX,L_RETURNFLAG,L_LINESTATUS,L_SHIPDATE,L_COMMITDATE,L_RECEIPTDATE,L_SHIPINSTRUCT,L_SHIPMODE,L_COMMENT');

2. Create a pre-aggregate table
create datamap agr_lineitem4 ON TABLE lineitem4 USING "org.apache.carbondata.datamap.AggregateDataMapHandler" as select L_RETURNFLAG,L_LINESTATUS,sum(L_QUANTITY),sum(L_EXTENDEDPRICE) from lineitem4 group by  L_RETURNFLAG, L_LINESTATUS;

3. Run aggregate query at the same time
 select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem4 group by l_returnflag, l_linestatus;

*+Expected:+*: aggregate query should fetch data either from main table or pre-aggregate table.
*+Actual:+* aggregate query does not return data until the pre-aggregate table is created


0: jdbc:hive2://10.18.98.48:23040> select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem4 group by l_returnflag, l_linestatus;
+---------------+---------------+------------------+-----------------------+--+
| l_returnflag  | l_linestatus  | sum(l_quantity)  | sum(l_extendedprice)  |
+---------------+---------------+------------------+-----------------------+--+
+---------------+---------------+------------------+-----------------------+--+
No rows selected (1.74 seconds)
0: jdbc:hive2://10.18.98.48:23040> select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem4 group by l_returnflag, l_linestatus;
+---------------+---------------+------------------+-----------------------+--+
| l_returnflag  | l_linestatus  | sum(l_quantity)  | sum(l_extendedprice)  |
+---------------+---------------+------------------+-----------------------+--+
+---------------+---------------+------------------+-----------------------+--+
No rows selected (0.746 seconds)
0: jdbc:hive2://10.18.98.48:23040> select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem4 group by l_returnflag, l_linestatus;
+---------------+---------------+------------------+------------------------+--+
| l_returnflag  | l_linestatus  | sum(l_quantity)  |  sum(l_extendedprice)  |
+---------------+---------------+------------------+------------------------+--+
| N             | F             | 2.9808092E7      | 4.471079473931997E10   |
| A             | F             | 1.145546488E9    | 1.717580824169429E12   |
| N             | O             | 2.31980219E9     | 3.4789002701143467E12  |
| R             | F             | 1.146403932E9    | 1.7190627928317903E12  |
+---------------+---------------+------------------+------------------------+--+
4 rows selected (0.8 seconds)
0: jdbc:hive2://10.18.98.48:23040> select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem4 group by l_returnflag, l_linestatus;
+---------------+---------------+------------------+------------------------+--+
| l_returnflag  | l_linestatus  | sum(l_quantity)  |  sum(l_extendedprice)  |
+---------------+---------------+------------------+------------------------+--+
| N             | F             | 2.9808092E7      | 4.471079473931997E10   |
| A             | F             | 1.145546488E9    | 1.717580824169429E12   |
| N             | O             | 2.31980219E9     | 3.4789002701143467E12  |
| R             | F             | 1.146403932E9    | 1.7190627928317903E12  |
+---------------+---------------+------------------+------------------------+--+


  was:
lineitem3: has a pre-aggregate table
select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem3 group by l_returnflag, l_linestatus order by l_returnflag, l_linestatus;
Error: org.apache.spark.sql.AnalysisException: expression '`lineitem3_l_returnflag`' is neither present in the group by, nor is it an aggregate function. Add to group by or wrap in first() (or first_value) if you don't care which value you get.;;
Project [l_returnflag#2356, l_linestatus#2366, sum(l_quantity)#2791, sum(l_extendedprice)#2792]
+- Sort [aggOrder#2795 ASC NULLS FIRST, aggOrder#2796 ASC NULLS FIRST], true
   +- !Aggregate [l_returnflag#2356, l_linestatus#2366], [l_returnflag#2356, l_linestatus#2366, sum(l_quantity#2362) AS sum(l_quantity)#2791, sum(l_extendedprice#2363) AS sum(l_extendedprice)#2792, lineitem3_l_returnflag#2341 AS aggOrder#2795, lineitem3_l_linestatus#2342 AS aggOrder#2796]
      +- SubqueryAlias lineitem3
         +- Relation[L_SHIPDATE#2353,L_SHIPMODE#2354,L_SHIPINSTRUCT#2355,L_RETURNFLAG#2356,L_RECEIPTDATE#2357,L_ORDERKEY#2358,L_PARTKEY#2359,L_SUPPKEY#2360,L_LINENUMBER#2361,L_QUANTITY#2362,L_EXTENDEDPRICE#2363,L_DISCOUNT#2364,L_TAX#2365,L_LINESTATUS#2366,L_COMMITDATE#2367,L_COMMENT#2368] CarbonDatasourceHadoopRelation [ Database name :test_db1, Table name :lineitem3, Schema :Some(StructType(StructField(L_SHIPDATE,StringType,true), StructField(L_SHIPMODE,StringType,true), StructField(L_SHIPINSTRUCT,StringType,true), StructField(L_RETURNFLAG,StringType,true), StructField(L_RECEIPTDATE,StringType,true), StructField(L_ORDERKEY,StringType,true), StructField(L_PARTKEY,StringType,true), StructField(L_SUPPKEY,StringType,true), StructField(L_LINENUMBER,IntegerType,true), StructField(L_QUANTITY,DoubleType,true), StructField(L_EXTENDEDPRICE,DoubleType,true), StructField(L_DISCOUNT,DoubleType,true), StructField(L_TAX,DoubleType,true), StructField(L_LINESTATUS,StringType,true), StructField(L_COMMITDATE,StringType,true), StructField(L_COMMENT,StringType,true))) ] (state=,code=0)

lineitem4: no pre-aggregate table created
select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem4 group by l_returnflag, l_linestatus order by l_returnflag, l_linestatus;
+---------------+---------------+------------------+------------------------+--+
| l_returnflag  | l_linestatus  | sum(l_quantity)  |  sum(l_extendedprice)  |
+---------------+---------------+------------------+------------------------+--+
| A             | F             | 1.263625E7       | 1.8938515425239815E10  |
| N             | F             | 327800.0         | 4.913876776200002E8    |
| N             | O             | 2.5398626E7      | 3.810981608977963E10   |
| R             | F             | 1.2643878E7      | 1.8948524305619884E10  |
+---------------+---------------+------------------+------------------------+--+

*+Expected:+*: aggregate query with order by should run fine
*+Actual:+* aggregate query with order failed




> Carbon1.3.0-Pre-AggregateTable - Query returns no value if run at the time of pre-aggregate table creation
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: CARBONDATA-1743
>                 URL: https://issues.apache.org/jira/browse/CARBONDATA-1743
>             Project: CarbonData
>          Issue Type: Bug
>          Components: data-load
>    Affects Versions: 1.3.0
>         Environment: Test - 3 node ant cluster
>            Reporter: Ramakrishna S
>              Labels: DFX
>             Fix For: 1.3.0
>
>
> Steps:
> 1. Create table and load with large data
> create table if not exists lineitem4(L_SHIPDATE string,L_SHIPMODE string,L_SHIPINSTRUCT string,L_RETURNFLAG string,L_RECEIPTDATE string,L_ORDERKEY string,L_PARTKEY string,L_SUPPKEY   string,L_LINENUMBER int,L_QUANTITY double,L_EXTENDEDPRICE double,L_DISCOUNT double,L_TAX double,L_LINESTATUS string,L_COMMITDATE string,L_COMMENT  string) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES ('table_blocksize'='128','NO_INVERTED_INDEX'='L_SHIPDATE,L_SHIPMODE,L_SHIPINSTRUCT,L_RETURNFLAG,L_RECEIPTDATE,L_ORDERKEY,L_PARTKEY,L_SUPPKEY','sort_columns'='');
> load data inpath "hdfs://hacluster/user/test/lineitem.tbl.1" into table lineitem4 options('DELIMITER'='|','FILEHEADER'='L_ORDERKEY,L_PARTKEY,L_SUPPKEY,L_LINENUMBER,L_QUANTITY,L_EXTENDEDPRICE,L_DISCOUNT,L_TAX,L_RETURNFLAG,L_LINESTATUS,L_SHIPDATE,L_COMMITDATE,L_RECEIPTDATE,L_SHIPINSTRUCT,L_SHIPMODE,L_COMMENT');
> 2. Create a pre-aggregate table
> create datamap agr_lineitem4 ON TABLE lineitem4 USING "org.apache.carbondata.datamap.AggregateDataMapHandler" as select L_RETURNFLAG,L_LINESTATUS,sum(L_QUANTITY),sum(L_EXTENDEDPRICE) from lineitem4 group by  L_RETURNFLAG, L_LINESTATUS;
> 3. Run aggregate query at the same time
>  select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem4 group by l_returnflag, l_linestatus;
> *+Expected:+*: aggregate query should fetch data either from main table or pre-aggregate table.
> *+Actual:+* aggregate query does not return data until the pre-aggregate table is created
> 0: jdbc:hive2://10.18.98.48:23040> select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem4 group by l_returnflag, l_linestatus;
> +---------------+---------------+------------------+-----------------------+--+
> | l_returnflag  | l_linestatus  | sum(l_quantity)  | sum(l_extendedprice)  |
> +---------------+---------------+------------------+-----------------------+--+
> +---------------+---------------+------------------+-----------------------+--+
> No rows selected (1.74 seconds)
> 0: jdbc:hive2://10.18.98.48:23040> select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem4 group by l_returnflag, l_linestatus;
> +---------------+---------------+------------------+-----------------------+--+
> | l_returnflag  | l_linestatus  | sum(l_quantity)  | sum(l_extendedprice)  |
> +---------------+---------------+------------------+-----------------------+--+
> +---------------+---------------+------------------+-----------------------+--+
> No rows selected (0.746 seconds)
> 0: jdbc:hive2://10.18.98.48:23040> select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem4 group by l_returnflag, l_linestatus;
> +---------------+---------------+------------------+------------------------+--+
> | l_returnflag  | l_linestatus  | sum(l_quantity)  |  sum(l_extendedprice)  |
> +---------------+---------------+------------------+------------------------+--+
> | N             | F             | 2.9808092E7      | 4.471079473931997E10   |
> | A             | F             | 1.145546488E9    | 1.717580824169429E12   |
> | N             | O             | 2.31980219E9     | 3.4789002701143467E12  |
> | R             | F             | 1.146403932E9    | 1.7190627928317903E12  |
> +---------------+---------------+------------------+------------------------+--+
> 4 rows selected (0.8 seconds)
> 0: jdbc:hive2://10.18.98.48:23040> select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem4 group by l_returnflag, l_linestatus;
> +---------------+---------------+------------------+------------------------+--+
> | l_returnflag  | l_linestatus  | sum(l_quantity)  |  sum(l_extendedprice)  |
> +---------------+---------------+------------------+------------------------+--+
> | N             | F             | 2.9808092E7      | 4.471079473931997E10   |
> | A             | F             | 1.145546488E9    | 1.717580824169429E12   |
> | N             | O             | 2.31980219E9     | 3.4789002701143467E12  |
> | R             | F             | 1.146403932E9    | 1.7190627928317903E12  |
> +---------------+---------------+------------------+------------------------+--+



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)