[jira] [Created] (CARBONDATA-1740) Carbon1.3.0-Pre-AggregateTable - Aggregate query with order by fails when main table is having pre-aggregate table

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

[jira] [Created] (CARBONDATA-1740) Carbon1.3.0-Pre-AggregateTable - Aggregate query with order by fails when main table is having pre-aggregate table

Akash R Nilugal (Jira)
Ramakrishna S created CARBONDATA-1740:
-----------------------------------------

             Summary: Carbon1.3.0-Pre-AggregateTable - Aggregate query with order by fails when main table is having pre-aggregate table
                 Key: CARBONDATA-1740
                 URL: https://issues.apache.org/jira/browse/CARBONDATA-1740
             Project: CarbonData
          Issue Type: Bug
          Components: data-load
    Affects Versions: 1.3.0
         Environment: Test - 3 node ant cluster
            Reporter: Ramakrishna S
             Fix For: 1.3.0


1. Create a table
create table if not exists lineitem2(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. Load 2 times to create 2 segments
 load data inpath "hdfs://hacluster/user/test/lineitem.tbl.5" into table lineitem2 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. Check the table content without setting any filter:
select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem2 group by l_returnflag, l_linestatus;
+---------------+---------------+------------------+------------------------+--+
| l_returnflag  | l_linestatus  | sum(l_quantity)  |  sum(l_extendedprice)  |
+---------------+---------------+------------------+------------------------+--+
| N             | F             | 327800.0         | 4.913876776200004E8    |
| A             | F             | 1.263625E7       | 1.893851542524009E10   |
| N             | O             | 2.5398626E7      | 3.810981608977967E10   |
| R             | F             | 1.2643878E7      | 1.8948524305619976E10  |
+---------------+---------------+------------------+------------------------+--+
4. Set segment filter on the main table:
set carbon.input.segments.test_db1.lineitem2=1;
+-------------------------------------------+--------+--+
|                    key                    | value  |
+-------------------------------------------+--------+--+
| carbon.input.segments.test_db1.lineitem2  | 1      |
+-------------------------------------------+--------+--+
5. Create pre-aggregate table
create datamap agr_lineitem2 ON TABLE lineitem2 USING "org.apache.carbondata.datamap.AggregateDataMapHandler" as select L_RETURNFLAG,L_LINESTATUS,sum(L_QUANTITY),sum(L_EXTENDEDPRICE) from lineitem2 group by  L_RETURNFLAG, L_LINESTATUS;
6. Check table content:
 select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem2 group by l_returnflag, l_linestatus;
+---------------+---------------+------------------+------------------------+--+
| l_returnflag  | l_linestatus  | sum(l_quantity)  |  sum(l_extendedprice)  |
+---------------+---------------+------------------+------------------------+--+
| N             | F             | 163900.0         | 2.4569383881000024E8   |
| A             | F             | 6318125.0        | 9.469257712620043E9    |
| N             | O             | 1.2699313E7      | 1.9054908044889835E10  |
| R             | F             | 6321939.0        | 9.474262152809986E9    |
+---------------+---------------+------------------+------------------------+--+

7. remove the filter on segment
0: jdbc:hive2://10.18.98.48:23040> reset;

8. Check the table conent:
 select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem2 group by l_returnflag, l_linestatus;
+---------------+---------------+------------------+------------------------+--+
| l_returnflag  | l_linestatus  | sum(l_quantity)  |  sum(l_extendedprice)  |
+---------------+---------------+------------------+------------------------+--+
| N             | F             | 163900.0         | 2.4569383881000024E8   |
| A             | F             | 6318125.0        | 9.469257712620043E9    |
| N             | O             | 1.2699313E7      | 1.9054908044889835E10  |
| R             | F             | 6321939.0        | 9.474262152809986E9    |
+---------------+---------------+------------------+------------------------+--+
4 rows selected (2.341 seconds)

9. Load one more time:
10. Check table content
select l_returnflag,l_linestatus,sum(l_quantity),sum(l_extendedprice) from lineitem2 group by l_returnflag, l_linestatus;
+---------------+---------------+------------------+------------------------+--+
| l_returnflag  | l_linestatus  | sum(l_quantity)  |  sum(l_extendedprice)  |
+---------------+---------------+------------------+------------------------+--+
| N             | F             | 327800.0         | 4.913876776200005E8    |
| A             | F             | 1.263625E7       | 1.8938515425240086E10  |
| N             | O             | 2.5398626E7      | 3.810981608977967E10   |
| R             | F             | 1.2643878E7      | 1.8948524305619972E10  |
+---------------+---------------+------------------+------------------------+--+
4 rows selected (0.936 seconds)


*+Expected:+*: one of these should have been the behavour:
1.Ignore segment filter and use all segments for pre-aggregate load. At the time of query run, if segment filter is set then ignore the pre-aggr table and fetch data from main table. (*Preferred*)
Or
2. Reject pre-aggregate creation when segment filter is set or vis-a-versa.

*+Actual:+* Partial data returned





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