[
https://issues.apache.org/jira/browse/CARBONDATA-1763?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ramakrishna S updated CARBONDATA-1763:
--------------------------------------
Description:
Steps:
1. Create table and load with data
2. Run update query on the table - this will take table metalock
3. In parallel run the pre-aggregate table create step - this will not be
allowed due to table lock
4. Rerun pre-aggegate table create step
*+Expected:+* Pre-aggregate table should be created
*+Actual:+* Pre-aggregate table creation fails
+Create, Load & Update+:
0: jdbc:hive2://10.18.98.136:23040> 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'='');
+---------+--+
| Result |
+---------+--+
+---------+--+
No rows selected (0.266 seconds)
0: jdbc:hive2://10.18.98.136:23040> load data inpath
"hdfs://hacluster/user/test/lineitem.tbl.5" 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');
+---------+--+
| Result |
+---------+--+
+---------+--+
No rows selected (6.331 seconds)
0: jdbc:hive2://10.18.98.136:23040> update lineitem4 set (l_linestatus) =
('xx');
+Create Datamap:+
0: jdbc:hive2://10.18.98.136:23040> create datamap agr_lineitem4 ON TABLE
lineitem4 USING "org.apache.carbondata.datamap.AggregateDataMapHandler" as
select
l_returnflag,l_linestatus,sum(l_quantity),avg(l_quantity),count(l_quantity)
from lineitem4 group by l_returnflag, l_linestatus;
Error: java.lang.RuntimeException: Acquire table lock failed after retry,
please try after some time (state=,code=0)
0: jdbc:hive2://10.18.98.136:23040> select
l_returnflag,l_linestatus,sum(l_quantity),avg(l_quantity),count(l_quantity)
from lineitem4 group by l_returnflag, l_linestatus;
+---------------+---------------+------------------+---------------------+--------------------+--+
| l_returnflag | l_linestatus | sum(l_quantity) | avg(l_quantity) |
count(l_quantity) |
+---------------+---------------+------------------+---------------------+--------------------+--+
| N | xx | 1.2863213E7 | 25.48745561614304 |
504688 |
| A | xx | 6318125.0 | 25.506342144783375 |
247708 |
| R | xx | 6321939.0 | 25.532459087898417 |
247604 |
+---------------+---------------+------------------+---------------------+--------------------+--+
3 rows selected (1.033 seconds)
0: jdbc:hive2://10.18.98.136:23040> create datamap agr_lineitem4 ON TABLE
lineitem4 USING "org.apache.carbondata.datamap.AggregateDataMapHandler" as
select
l_returnflag,l_linestatus,sum(l_quantity),avg(l_quantity),count(l_quantity)
from lineitem4 group by l_returnflag, l_linestatus;
Error: java.lang.RuntimeException: Table [lineitem4_agr_lineitem4] already
exists under database [test_db1] (state=,code=0)
was:
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 |
+---------------+---------------+------------------+------------------------+--+
> Carbon1.3.0-Pre-AggregateTable - Recreating a failed pre-aggregate table
> fails due to table exists
> --------------------------------------------------------------------------------------------------
>
> Key: CARBONDATA-1763
> URL: https://issues.apache.org/jira/browse/CARBONDATA-1763
> Project: CarbonData
> Issue Type: Bug
> Components: data-load
> Affects Versions: 1.3.0
> Environment: Test - 3 node ant cluster
> Reporter: Ramakrishna S
> Assignee: Kunal Kapoor
> Labels: DFX
> Fix For: 1.3.0
>
>
> Steps:
> 1. Create table and load with data
> 2. Run update query on the table - this will take table metalock
> 3. In parallel run the pre-aggregate table create step - this will not be
> allowed due to table lock
> 4. Rerun pre-aggegate table create step
> *+Expected:+* Pre-aggregate table should be created
> *+Actual:+* Pre-aggregate table creation fails
> +Create, Load & Update+:
> 0: jdbc:hive2://10.18.98.136:23040> 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'='');
> +---------+--+
> | Result |
> +---------+--+
> +---------+--+
> No rows selected (0.266 seconds)
> 0: jdbc:hive2://10.18.98.136:23040> load data inpath
> "hdfs://hacluster/user/test/lineitem.tbl.5" 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');
> +---------+--+
> | Result |
> +---------+--+
> +---------+--+
> No rows selected (6.331 seconds)
> 0: jdbc:hive2://10.18.98.136:23040> update lineitem4 set (l_linestatus) =
> ('xx');
> +Create Datamap:+
> 0: jdbc:hive2://10.18.98.136:23040> create datamap agr_lineitem4 ON TABLE
> lineitem4 USING "org.apache.carbondata.datamap.AggregateDataMapHandler" as
> select
> l_returnflag,l_linestatus,sum(l_quantity),avg(l_quantity),count(l_quantity)
> from lineitem4 group by l_returnflag, l_linestatus;
> Error: java.lang.RuntimeException: Acquire table lock failed after retry,
> please try after some time (state=,code=0)
> 0: jdbc:hive2://10.18.98.136:23040> select
> l_returnflag,l_linestatus,sum(l_quantity),avg(l_quantity),count(l_quantity)
> from lineitem4 group by l_returnflag, l_linestatus;
> +---------------+---------------+------------------+---------------------+--------------------+--+
> | l_returnflag | l_linestatus | sum(l_quantity) | avg(l_quantity) |
> count(l_quantity) |
> +---------------+---------------+------------------+---------------------+--------------------+--+
> | N | xx | 1.2863213E7 | 25.48745561614304 |
> 504688 |
> | A | xx | 6318125.0 | 25.506342144783375 |
> 247708 |
> | R | xx | 6321939.0 | 25.532459087898417 |
> 247604 |
> +---------------+---------------+------------------+---------------------+--------------------+--+
> 3 rows selected (1.033 seconds)
> 0: jdbc:hive2://10.18.98.136:23040> create datamap agr_lineitem4 ON TABLE
> lineitem4 USING "org.apache.carbondata.datamap.AggregateDataMapHandler" as
> select
> l_returnflag,l_linestatus,sum(l_quantity),avg(l_quantity),count(l_quantity)
> from lineitem4 group by l_returnflag, l_linestatus;
> Error: java.lang.RuntimeException: Table [lineitem4_agr_lineitem4] already
> exists under database [test_db1] (state=,code=0)
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)