You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jd...@apache.org on 2016/03/17 23:47:41 UTC
[37/51] [abbrv] hive git commit: HIVE-13201 : Compaction shouldn't be
allowed on non-ACID table (Wei Zheng, reviewed by Alan Gates)
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/b6af0124
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/b6af0124
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/b6af0124
Branch: refs/heads/llap
Commit: b6af0124b351ba759a15c81f8ececd7920115b2f
Parents: e7a1756
Author: Wei Zheng <we...@apache.org>
Authored: Mon Mar 14 14:34:28 2016 -0700
Committer: Wei Zheng <we...@apache.org>
Committed: Mon Mar 14 14:34:28 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/b6af0124/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 f0cc3a2..f091f67 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
@@ -397,6 +397,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/b6af0124/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 2a64cfa..56eecf6 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
@@ -1745,6 +1745,10 @@ public class DDLTask extends Task<DDLWork> 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/b6af0124/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/b6af0124/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/b6af0124/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/b6af0124/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/b6af0124/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/b6af0124/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/b6af0124/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/b6af0124/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