Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 252E0194B6 for ; Mon, 14 Mar 2016 21:46:12 +0000 (UTC) Received: (qmail 166 invoked by uid 500); 14 Mar 2016 21:46:12 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 105 invoked by uid 500); 14 Mar 2016 21:46:11 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 99993 invoked by uid 99); 14 Mar 2016 21:46:11 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Mar 2016 21:46:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B46BFDFB8A; Mon, 14 Mar 2016 21:46:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: weiz@apache.org To: commits@hive.apache.org Message-Id: <07dbdcb87a32413486b6adc65ef8364d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: hive git commit: HIVE-13201 : Compaction shouldn't be allowed on non-ACID table (Wei Zheng, reviewed by Alan Gates) Date: Mon, 14 Mar 2016 21:46:11 +0000 (UTC) Repository: hive Updated Branches: refs/heads/branch-1 214e4b6ff -> 1c44f4ccd HIVE-13201 : Compaction shouldn't be allowed on non-ACID table (Wei Zheng, reviewed by Alan Gates) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1c44f4cc Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1c44f4cc Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1c44f4cc Branch: refs/heads/branch-1 Commit: 1c44f4ccdcf1d2e47b9132a45e57c04b27ec6ac2 Parents: 214e4b6 Author: Wei Zheng Authored: Mon Mar 14 14:45:54 2016 -0700 Committer: Wei Zheng Committed: Mon Mar 14 14:45:54 2016 -0700 ---------------------------------------------------------------------- ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java | 1 + ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java | 4 ++++ .../test/queries/clientnegative/compact_non_acid_table.q | 11 +++++++++++ ql/src/test/queries/clientpositive/dbtxnmgr_compact1.q | 2 +- ql/src/test/queries/clientpositive/dbtxnmgr_compact2.q | 2 +- ql/src/test/queries/clientpositive/dbtxnmgr_compact3.q | 2 +- .../results/clientnegative/compact_non_acid_table.q.out | 11 +++++++++++ .../test/results/clientpositive/dbtxnmgr_compact1.q.out | 4 ++-- .../test/results/clientpositive/dbtxnmgr_compact2.q.out | 4 ++-- .../test/results/clientpositive/dbtxnmgr_compact3.q.out | 4 ++-- 10 files changed, 36 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/1c44f4cc/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java b/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java index 77e82a4..160a31d 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java @@ -407,6 +407,7 @@ public enum ErrorMsg { TOO_MANY_COMPACTION_PARTITIONS(10284, "Compaction can only be requested on one partition at a " + "time."), DISTINCT_NOT_SUPPORTED(10285, "Distinct keyword is not support in current context"), + NONACID_COMPACTION_NOT_SUPPORTED(10286, "Compaction is not allowed on non-ACID table {0}.{1}", true), UPDATEDELETE_PARSE_ERROR(10290, "Encountered parse error while parsing rewritten update or " + "delete query"), http://git-wip-us.apache.org/repos/asf/hive/blob/1c44f4cc/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java index 3d8ca92..414293c 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java @@ -1710,6 +1710,10 @@ public class DDLTask extends Task implements Serializable { private int compact(Hive db, AlterTableSimpleDesc desc) throws HiveException { Table tbl = db.getTable(desc.getTableName()); + if (!AcidUtils.isAcidTable(tbl)) { + throw new HiveException(ErrorMsg.NONACID_COMPACTION_NOT_SUPPORTED, tbl.getDbName(), + tbl.getTableName()); + } String partName = null; if (desc.getPartSpec() == null) { http://git-wip-us.apache.org/repos/asf/hive/blob/1c44f4cc/ql/src/test/queries/clientnegative/compact_non_acid_table.q ---------------------------------------------------------------------- diff --git a/ql/src/test/queries/clientnegative/compact_non_acid_table.q b/ql/src/test/queries/clientnegative/compact_non_acid_table.q new file mode 100644 index 0000000..e9faa24 --- /dev/null +++ b/ql/src/test/queries/clientnegative/compact_non_acid_table.q @@ -0,0 +1,11 @@ +set hive.mapred.mode=nonstrict; +set hive.support.concurrency=true; +set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager; +set hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat; + + +create table not_an_acid_table (a int, b varchar(128)); + +alter table not_an_acid_table compact 'major'; + +drop table not_an_acid_table; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hive/blob/1c44f4cc/ql/src/test/queries/clientpositive/dbtxnmgr_compact1.q ---------------------------------------------------------------------- diff --git a/ql/src/test/queries/clientpositive/dbtxnmgr_compact1.q b/ql/src/test/queries/clientpositive/dbtxnmgr_compact1.q index 7f71305..b86c6f9 100644 --- a/ql/src/test/queries/clientpositive/dbtxnmgr_compact1.q +++ b/ql/src/test/queries/clientpositive/dbtxnmgr_compact1.q @@ -1,7 +1,7 @@ set hive.support.concurrency=true; set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager; -create table T1(key string, val string) stored as textfile; +create table T1(key string, val string) clustered by (val) into 2 buckets stored as ORC TBLPROPERTIES ('transactional'='true'); alter table T1 compact 'major'; http://git-wip-us.apache.org/repos/asf/hive/blob/1c44f4cc/ql/src/test/queries/clientpositive/dbtxnmgr_compact2.q ---------------------------------------------------------------------- diff --git a/ql/src/test/queries/clientpositive/dbtxnmgr_compact2.q b/ql/src/test/queries/clientpositive/dbtxnmgr_compact2.q index 4759d65..dca954e 100644 --- a/ql/src/test/queries/clientpositive/dbtxnmgr_compact2.q +++ b/ql/src/test/queries/clientpositive/dbtxnmgr_compact2.q @@ -1,7 +1,7 @@ set hive.support.concurrency=true; set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager; -create table T1(key string, val string) partitioned by (ds string) stored as textfile; +create table T1(key string, val string) partitioned by (ds string) clustered by (val) into 2 buckets stored as ORC TBLPROPERTIES ('transactional'='true'); alter table T1 add partition (ds = 'today'); alter table T1 add partition (ds = 'yesterday'); http://git-wip-us.apache.org/repos/asf/hive/blob/1c44f4cc/ql/src/test/queries/clientpositive/dbtxnmgr_compact3.q ---------------------------------------------------------------------- diff --git a/ql/src/test/queries/clientpositive/dbtxnmgr_compact3.q b/ql/src/test/queries/clientpositive/dbtxnmgr_compact3.q index 23b3959..8c7bc25 100644 --- a/ql/src/test/queries/clientpositive/dbtxnmgr_compact3.q +++ b/ql/src/test/queries/clientpositive/dbtxnmgr_compact3.q @@ -5,7 +5,7 @@ create database D1; use D1; -create table T1(key string, val string) stored as textfile; +create table T1(key string, val string) clustered by (val) into 2 buckets stored as ORC TBLPROPERTIES ('transactional'='true'); alter table T1 compact 'major'; http://git-wip-us.apache.org/repos/asf/hive/blob/1c44f4cc/ql/src/test/results/clientnegative/compact_non_acid_table.q.out ---------------------------------------------------------------------- diff --git a/ql/src/test/results/clientnegative/compact_non_acid_table.q.out b/ql/src/test/results/clientnegative/compact_non_acid_table.q.out new file mode 100644 index 0000000..eab9e19 --- /dev/null +++ b/ql/src/test/results/clientnegative/compact_non_acid_table.q.out @@ -0,0 +1,11 @@ +PREHOOK: query: create table not_an_acid_table (a int, b varchar(128)) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@not_an_acid_table +POSTHOOK: query: create table not_an_acid_table (a int, b varchar(128)) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@not_an_acid_table +PREHOOK: query: alter table not_an_acid_table compact 'major' +PREHOOK: type: ALTERTABLE_COMPACT +FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Compaction is not allowed on non-ACID table default.not_an_acid_table http://git-wip-us.apache.org/repos/asf/hive/blob/1c44f4cc/ql/src/test/results/clientpositive/dbtxnmgr_compact1.q.out ---------------------------------------------------------------------- diff --git a/ql/src/test/results/clientpositive/dbtxnmgr_compact1.q.out b/ql/src/test/results/clientpositive/dbtxnmgr_compact1.q.out index 46216f9..0dad32d 100644 --- a/ql/src/test/results/clientpositive/dbtxnmgr_compact1.q.out +++ b/ql/src/test/results/clientpositive/dbtxnmgr_compact1.q.out @@ -1,8 +1,8 @@ -PREHOOK: query: create table T1(key string, val string) stored as textfile +PREHOOK: query: create table T1(key string, val string) clustered by (val) into 2 buckets stored as ORC TBLPROPERTIES ('transactional'='true') PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@T1 -POSTHOOK: query: create table T1(key string, val string) stored as textfile +POSTHOOK: query: create table T1(key string, val string) clustered by (val) into 2 buckets stored as ORC TBLPROPERTIES ('transactional'='true') POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@T1 http://git-wip-us.apache.org/repos/asf/hive/blob/1c44f4cc/ql/src/test/results/clientpositive/dbtxnmgr_compact2.q.out ---------------------------------------------------------------------- diff --git a/ql/src/test/results/clientpositive/dbtxnmgr_compact2.q.out b/ql/src/test/results/clientpositive/dbtxnmgr_compact2.q.out index 40280a9..2114575 100644 --- a/ql/src/test/results/clientpositive/dbtxnmgr_compact2.q.out +++ b/ql/src/test/results/clientpositive/dbtxnmgr_compact2.q.out @@ -1,8 +1,8 @@ -PREHOOK: query: create table T1(key string, val string) partitioned by (ds string) stored as textfile +PREHOOK: query: create table T1(key string, val string) partitioned by (ds string) clustered by (val) into 2 buckets stored as ORC TBLPROPERTIES ('transactional'='true') PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@T1 -POSTHOOK: query: create table T1(key string, val string) partitioned by (ds string) stored as textfile +POSTHOOK: query: create table T1(key string, val string) partitioned by (ds string) clustered by (val) into 2 buckets stored as ORC TBLPROPERTIES ('transactional'='true') POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@T1 http://git-wip-us.apache.org/repos/asf/hive/blob/1c44f4cc/ql/src/test/results/clientpositive/dbtxnmgr_compact3.q.out ---------------------------------------------------------------------- diff --git a/ql/src/test/results/clientpositive/dbtxnmgr_compact3.q.out b/ql/src/test/results/clientpositive/dbtxnmgr_compact3.q.out index 07e4e6d..1fa090f 100644 --- a/ql/src/test/results/clientpositive/dbtxnmgr_compact3.q.out +++ b/ql/src/test/results/clientpositive/dbtxnmgr_compact3.q.out @@ -10,11 +10,11 @@ PREHOOK: Input: database:d1 POSTHOOK: query: use D1 POSTHOOK: type: SWITCHDATABASE POSTHOOK: Input: database:d1 -PREHOOK: query: create table T1(key string, val string) stored as textfile +PREHOOK: query: create table T1(key string, val string) clustered by (val) into 2 buckets stored as ORC TBLPROPERTIES ('transactional'='true') PREHOOK: type: CREATETABLE PREHOOK: Output: D1@T1 PREHOOK: Output: database:d1 -POSTHOOK: query: create table T1(key string, val string) stored as textfile +POSTHOOK: query: create table T1(key string, val string) clustered by (val) into 2 buckets stored as ORC TBLPROPERTIES ('transactional'='true') POSTHOOK: type: CREATETABLE POSTHOOK: Output: D1@T1 POSTHOOK: Output: database:d1