Rajesh Balamohan created HIVE-11725:
---------------------------------------
Summary: Delete on ACID enabled table provides wrong results
Key: HIVE-11725
URL: https://issues.apache.org/jira/browse/HIVE-11725
Project: Hive
Issue Type: Bug
Reporter: Rajesh Balamohan
This is based on the master codebase (last commit:
492c8b1d88ffcb68ba4f77a3a49ae8fc768cdd7c)
Created a table with TBLPROPERTIES("transactional"="true",
"NO_AUTO_COMPACTION"="true"). Populated bunch of records in the table and
deleted few of them. Select query after delete does not seem to consider the
deleted records.
{noformat}
set hive.support.concurrency=true;
set hive.enforce.bucketing=true;
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
set hive.compactor.initiator.on=false;
set hive.compactor.worker.threads=0;
DROP TABLE `lineitem_acid_bucket`;
CREATE TABLE `lineitem_acid_bucket`(
`l_orderkey` bigint,
`l_partkey` bigint,
`l_suppkey` bigint,
`l_linenumber` bigint,
`l_quantity` double,
`l_extendedprice` double,
`l_discount` double,
`l_tax` double,
`l_returnflag` string,
`l_linestatus` string,
`l_shipdate` string,
`l_commitdate` string,
`l_receiptdate` string,
`l_shipinstruct` string,
`l_shipmode` string,
`l_comment` string)
CLUSTERED BY (l_orderkey)
INTO 256 BUCKETS STORED AS ORC TBLPROPERTIES("transactional"="true",
"NO_AUTO_COMPACTION"="true"); <-- intentionally enabled NO_AUTO_COMPACTION,
so that user can have control on compaction
-- Populate some data from master lineitem table which has data
INSERT INTO lineitem_acid_bucket SELECT * FROM lineitem WHERE l_orderkey > 0
AND l_orderkey < 10000000;
INSERT INTO lineitem_acid_bucket SELECT * FROM lineitem WHERE l_orderkey >
10000001 AND l_orderkey < 20000000;
INSERT INTO lineitem_acid_bucket SELECT * FROM lineitem WHERE l_orderkey >
20000001 AND l_orderkey < 30000000;
INSERT INTO lineitem_acid_bucket SELECT * FROM lineitem WHERE l_orderkey >
30000001 AND l_orderkey < 40000000;
INSERT INTO lineitem_acid_bucket SELECT * FROM lineitem WHERE l_orderkey >
40000001 AND l_orderkey < 50000000;
INSERT INTO lineitem_acid_bucket SELECT * FROM lineitem WHERE l_orderkey >
50000001 AND l_orderkey < 60000000;
INSERT INTO lineitem_acid_bucket SELECT * FROM lineitem WHERE l_orderkey >
60000001 AND l_orderkey < 70000000;
INSERT INTO lineitem_acid_bucket SELECT * FROM lineitem WHERE l_orderkey >
70000001 AND l_orderkey < 80000000;
INSERT INTO lineitem_acid_bucket SELECT * FROM lineitem WHERE l_orderkey >
80000001 AND l_orderkey < 90000000;
SELECT count(*) FROM lineitem_acid_bucket WHERE l_orderkey > 15000001 and
l_orderkey < 65000000;
49990192
DELETE FROM lineitem_acid_bucket WHERE l_orderkey > 15000001 and l_orderkey <
20000000;
INFO : Table rajesh.lineitem_acid_bucket stats: [numFiles=2368,
numRows=84989293, totalSize=2921444884, rawDataSize=0]
Run the same select query again
SELECT count(*) FROM lineitem_acid_bucket WHERE l_orderkey > 15000001 and
l_orderkey < 65000000;
44992181 <--- wrong value
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)