hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject [46/50] [abbrv] hive git commit: HIVE-10934: Restore support for DROP PARTITION PURGE (Eugene Koifman via Gunther Hagleitner)
Date Fri, 05 Jun 2015 23:16:59 GMT
HIVE-10934: Restore support for DROP PARTITION PURGE (Eugene Koifman via Gunther Hagleitner)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/bef52661
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/bef52661
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/bef52661

Branch: refs/heads/hbase-metastore
Commit: bef52661cdacc22ea6dc06d7b09cad49a63d0bf9
Parents: 17bedcc
Author: Gunther Hagleitner <gunther@apache.org>
Authored: Thu Jun 4 16:14:25 2015 -0700
Committer: Gunther Hagleitner <gunther@apache.org>
Committed: Thu Jun 4 16:14:25 2015 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hive/ql/parse/HiveParser.g    |  4 +-
 .../clientpositive/alter_table_partition_drop.q | 11 +++
 .../alter_table_partition_drop.q.out            | 74 ++++++++++++++++++++
 3 files changed, 87 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/bef52661/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
index b267bd2..15f1f11 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
@@ -1166,8 +1166,8 @@ partitionLocation
 alterStatementSuffixDropPartitions[boolean table]
 @init { pushMsg("drop partition statement", state); }
 @after { popMsg(state); }
-    : KW_DROP ifExists? dropPartitionSpec (COMMA dropPartitionSpec)* ignoreProtection? replicationClause?
-    -> { table }? ^(TOK_ALTERTABLE_DROPPARTS dropPartitionSpec+ ifExists? ignoreProtection?
replicationClause?)
+    : KW_DROP ifExists? dropPartitionSpec (COMMA dropPartitionSpec)* ignoreProtection? KW_PURGE?
replicationClause?
+    -> { table }? ^(TOK_ALTERTABLE_DROPPARTS dropPartitionSpec+ ifExists? ignoreProtection?
KW_PURGE? replicationClause?)
     ->            ^(TOK_ALTERVIEW_DROPPARTS dropPartitionSpec+ ifExists? ignoreProtection?
replicationClause?)
     ;
 

http://git-wip-us.apache.org/repos/asf/hive/blob/bef52661/ql/src/test/queries/clientpositive/alter_table_partition_drop.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/alter_table_partition_drop.q b/ql/src/test/queries/clientpositive/alter_table_partition_drop.q
new file mode 100644
index 0000000..fb1d401
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/alter_table_partition_drop.q
@@ -0,0 +1,11 @@
+set hive.exec.dynamic.partition.mode=nonstrict;
+
+DROP TABLE IF EXISTS part_table PURGE;
+CREATE TABLE part_table (key INT, value STRING) partitioned by (p STRING);
+
+INSERT INTO part_table PARTITION(p)(p,key,value) values('2014-09-23', 1, 'foo'),('2014-09-24',
2, 'bar');
+SELECT * FROM part_table;
+ALTER TABLE part_table DROP PARTITION (p='2014-09-23');
+SELECT * FROM part_table;
+ALTER TABLE part_table DROP PARTITION (p='2014-09-24') PURGE;
+SELECT * FROM part_table;

http://git-wip-us.apache.org/repos/asf/hive/blob/bef52661/ql/src/test/results/clientpositive/alter_table_partition_drop.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/alter_table_partition_drop.q.out b/ql/src/test/results/clientpositive/alter_table_partition_drop.q.out
new file mode 100644
index 0000000..9a94bb9
--- /dev/null
+++ b/ql/src/test/results/clientpositive/alter_table_partition_drop.q.out
@@ -0,0 +1,74 @@
+PREHOOK: query: DROP TABLE IF EXISTS part_table PURGE
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE IF EXISTS part_table PURGE
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE part_table (key INT, value STRING) partitioned by (p STRING)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@part_table
+POSTHOOK: query: CREATE TABLE part_table (key INT, value STRING) partitioned by (p STRING)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@part_table
+PREHOOK: query: INSERT INTO part_table PARTITION(p)(p,key,value) values('2014-09-23', 1,
'foo'),('2014-09-24', 2, 'bar')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__1
+PREHOOK: Output: default@part_table
+POSTHOOK: query: INSERT INTO part_table PARTITION(p)(p,key,value) values('2014-09-23', 1,
'foo'),('2014-09-24', 2, 'bar')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@values__tmp__table__1
+POSTHOOK: Output: default@part_table@p=2014-09-23
+POSTHOOK: Output: default@part_table@p=2014-09-24
+POSTHOOK: Lineage: part_table PARTITION(p=2014-09-23).key EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2,
type:string, comment:), ]
+POSTHOOK: Lineage: part_table PARTITION(p=2014-09-23).value SIMPLE [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col3,
type:string, comment:), ]
+POSTHOOK: Lineage: part_table PARTITION(p=2014-09-24).key EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2,
type:string, comment:), ]
+POSTHOOK: Lineage: part_table PARTITION(p=2014-09-24).value SIMPLE [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col3,
type:string, comment:), ]
+PREHOOK: query: SELECT * FROM part_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@part_table
+PREHOOK: Input: default@part_table@p=2014-09-23
+PREHOOK: Input: default@part_table@p=2014-09-24
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM part_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@part_table
+POSTHOOK: Input: default@part_table@p=2014-09-23
+POSTHOOK: Input: default@part_table@p=2014-09-24
+#### A masked pattern was here ####
+1	foo	2014-09-23
+2	bar	2014-09-24
+PREHOOK: query: ALTER TABLE part_table DROP PARTITION (p='2014-09-23')
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@part_table
+PREHOOK: Output: default@part_table@p=2014-09-23
+POSTHOOK: query: ALTER TABLE part_table DROP PARTITION (p='2014-09-23')
+POSTHOOK: type: ALTERTABLE_DROPPARTS
+POSTHOOK: Input: default@part_table
+POSTHOOK: Output: default@part_table@p=2014-09-23
+PREHOOK: query: SELECT * FROM part_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@part_table
+PREHOOK: Input: default@part_table@p=2014-09-24
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM part_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@part_table
+POSTHOOK: Input: default@part_table@p=2014-09-24
+#### A masked pattern was here ####
+2	bar	2014-09-24
+PREHOOK: query: ALTER TABLE part_table DROP PARTITION (p='2014-09-24') PURGE
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@part_table
+PREHOOK: Output: default@part_table@p=2014-09-24
+POSTHOOK: query: ALTER TABLE part_table DROP PARTITION (p='2014-09-24') PURGE
+POSTHOOK: type: ALTERTABLE_DROPPARTS
+POSTHOOK: Input: default@part_table
+POSTHOOK: Output: default@part_table@p=2014-09-24
+PREHOOK: query: SELECT * FROM part_table
+PREHOOK: type: QUERY
+PREHOOK: Input: default@part_table
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM part_table
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@part_table
+#### A masked pattern was here ####


Mime
View raw message