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

[jira] [Created] (CARBONDATA-2045) Query from segment set is not effective when pre-aggregate table is present

kumar vishal created CARBONDATA-2045:
----------------------------------------

             Summary: Query from segment set is not effective when pre-aggregate table is present
                 Key: CARBONDATA-2045
                 URL: https://issues.apache.org/jira/browse/CARBONDATA-2045
             Project: CarbonData
          Issue Type: Bug
            Reporter: kumar vishal
            Assignee: kumar vishal


1. Create a table
create table if not exists lineitem1(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'='');
2. Run load :
load data inpath "hdfs://hacluster/user/test/lineitem.tbl.1" into table lineitem1 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');

3. create pre-agg table 
create datamap agr_lineitem3 ON TABLE lineitem3 USING "org.apache.carbondata.datamap.AggregateDataMapHandler" as select L_RETURNFLAG,L_LINESTATUS,sum(L_QUANTITY),sum(L_EXTENDEDPRICE) from lineitem3 group by L_RETURNFLAG, L_LINESTATUS;

3. Check table content using aggregate query:
select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem3 group by l_returnflag, l_linestatus;

+----------------+--------------++------------------------------------------++--
|l_returnflag|l_linestatus|sum(l_quantity)|sum(l_extendedprice)|

+----------------+--------------++------------------------------------------++--
|N|F|4913382.0|7.369901176949993E9|
|A|F|1.88818373E8|2.8310705145736383E11|
|N|O|3.82400594E8|5.734650756707479E11|
|R|F|1.88960009E8|2.833523780876951E11|

+----------------+--------------++------------------------------------------++--
4 rows selected (1.568 seconds)

4. Load one more time:
load data inpath "hdfs://hacluster/user/test/lineitem.tbl.1" into table lineitem1 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');

5. Check table content using aggregate query:
select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem3 group by l_returnflag, l_linestatus;

+----------------+--------------++------------------------------------------++--
|l_returnflag|l_linestatus|sum(l_quantity)|sum(l_extendedprice)|

+----------------+--------------++------------------------------------------++--
|N|F|9826764.0|1.4739802353899986E10|
|A|F|3.77636746E8|5.662141029147278E11|
|N|O|7.64801188E8|1.1469301513414958E12|
|R|F|3.77920018E8|5.667047561753901E11|

+----------------+--------------++------------------------------------------++--

6. Set query from segment 1:

0: jdbc:hive2://10.18.98.48:23040> set carbon.input.segments.test_db1.lilneitem1=1;
+---------------------------------------------+-------++--
|key|value|

+---------------------------------------------+-------++--
|carbon.input.segments.test_db1.lilneitem1|1|

+---------------------------------------------+-------++--

7. Check table content using aggregate query:
select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem3 group by l_returnflag, l_linestatus;

*+Expected+*: It should return the values from segment 1 alone.
*+Actual :+* : It returns values from both segments
+----------------+--------------++------------------------------------------++--
|l_returnflag|l_linestatus|sum(l_quantity)|sum(l_extendedprice)|

+----------------+--------------++------------------------------------------++--
|N|F|9826764.0|1.4739802353899986E10|
|A|F|3.77636746E8|5.662141029147278E11|
|N|O|7.64801188E8|1.1469301513414958E12|
|R|F|3.77920018E8|5.667047561753901E11|

+----------------+--------------++------------------------------------------++--



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