hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject [10/50] [abbrv] hive git commit: HIVE-17309 alter partition onto a table not in current database throw InvalidOperationException (Wang Haihua via Alan Gates)
Date Thu, 07 Sep 2017 05:58:24 GMT
HIVE-17309 alter partition onto a table not in current database throw InvalidOperationException
(Wang Haihua via Alan Gates)


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

Branch: refs/heads/hive-14535
Commit: e352ef409571383bcd546f399a17fc7c8a6e6bf0
Parents: 3fc131c
Author: Alan Gates <gates@hortonworks.com>
Authored: Mon Aug 28 12:51:31 2017 -0700
Committer: Alan Gates <gates@hortonworks.com>
Committed: Mon Aug 28 12:51:31 2017 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/exec/DDLTask.java |  2 +-
 .../alter_partition_onto_nocurrent_db.q         | 15 ++++
 .../alter_partition_onto_nocurrent_db.q.out     | 78 ++++++++++++++++++++
 3 files changed, 94 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/e352ef40/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 364db27..acc2390 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
@@ -3646,7 +3646,7 @@ public class DDLTask extends Task<DDLWork> implements Serializable
{
       if (allPartitions == null) {
         db.alterTable(alterTbl.getOldName(), tbl, alterTbl.getIsCascade(), alterTbl.getEnvironmentContext());
       } else {
-        db.alterPartitions(alterTbl.getOldName(), allPartitions, alterTbl.getEnvironmentContext());
+        db.alterPartitions(Warehouse.getQualifiedName(tbl.getTTable()), allPartitions, alterTbl.getEnvironmentContext());
       }
       // Add constraints if necessary
       addConstraints(db, alterTbl);

http://git-wip-us.apache.org/repos/asf/hive/blob/e352ef40/ql/src/test/queries/clientpositive/alter_partition_onto_nocurrent_db.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/alter_partition_onto_nocurrent_db.q b/ql/src/test/queries/clientpositive/alter_partition_onto_nocurrent_db.q
new file mode 100644
index 0000000..017fd44
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/alter_partition_onto_nocurrent_db.q
@@ -0,0 +1,15 @@
+CREATE DATABASE test_db_nocurr;
+
+CREATE TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb (a INT) PARTITIONED
BY (ds STRING) STORED AS SEQUENCEFILE;
+
+INSERT OVERWRITE TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb PARTITION(ds='eleme_haihua')
SELECT 1;
+
+desc extended test_db_nocurr.test_table_for_alter_partition_nocurrentdb partition(ds='eleme_haihua');
+
+ALTER TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb partition(ds='eleme_haihua')
CHANGE COLUMN a a_new BOOLEAN;
+
+desc extended test_db_nocurr.test_table_for_alter_partition_nocurrentdb partition(ds='eleme_haihua');
+
+DROP TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb;
+
+DROP DATABASE test_db_nocurr;

http://git-wip-us.apache.org/repos/asf/hive/blob/e352ef40/ql/src/test/results/clientpositive/alter_partition_onto_nocurrent_db.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/alter_partition_onto_nocurrent_db.q.out b/ql/src/test/results/clientpositive/alter_partition_onto_nocurrent_db.q.out
new file mode 100644
index 0000000..f109bcc
--- /dev/null
+++ b/ql/src/test/results/clientpositive/alter_partition_onto_nocurrent_db.q.out
@@ -0,0 +1,78 @@
+PREHOOK: query: CREATE DATABASE test_db_nocurr
+PREHOOK: type: CREATEDATABASE
+PREHOOK: Output: database:test_db_nocurr
+POSTHOOK: query: CREATE DATABASE test_db_nocurr
+POSTHOOK: type: CREATEDATABASE
+POSTHOOK: Output: database:test_db_nocurr
+PREHOOK: query: CREATE TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb (a
INT) PARTITIONED BY (ds STRING) STORED AS SEQUENCEFILE
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:test_db_nocurr
+PREHOOK: Output: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+POSTHOOK: query: CREATE TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb (a
INT) PARTITIONED BY (ds STRING) STORED AS SEQUENCEFILE
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:test_db_nocurr
+POSTHOOK: Output: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+PREHOOK: query: INSERT OVERWRITE TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb
PARTITION(ds='eleme_haihua') SELECT 1
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: test_db_nocurr@test_table_for_alter_partition_nocurrentdb@ds=eleme_haihua
+POSTHOOK: query: INSERT OVERWRITE TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb
PARTITION(ds='eleme_haihua') SELECT 1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: test_db_nocurr@test_table_for_alter_partition_nocurrentdb@ds=eleme_haihua
+POSTHOOK: Lineage: test_table_for_alter_partition_nocurrentdb PARTITION(ds=eleme_haihua).a
SIMPLE []
+PREHOOK: query: desc extended test_db_nocurr.test_table_for_alter_partition_nocurrentdb partition(ds='eleme_haihua')
+PREHOOK: type: DESCTABLE
+PREHOOK: Input: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+POSTHOOK: query: desc extended test_db_nocurr.test_table_for_alter_partition_nocurrentdb
partition(ds='eleme_haihua')
+POSTHOOK: type: DESCTABLE
+POSTHOOK: Input: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+a                   	int                 	                    
+ds                  	string              	                    
+	 	 
+# Partition Information	 	 
+# col_name            	data_type           	comment             
+	 	 
+ds                  	string              	                    
+	 	 
+#### A masked pattern was here ####
+PREHOOK: query: ALTER TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb partition(ds='eleme_haihua')
CHANGE COLUMN a a_new BOOLEAN
+PREHOOK: type: ALTERTABLE_RENAMECOL
+PREHOOK: Input: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+PREHOOK: Output: test_db_nocurr@test_table_for_alter_partition_nocurrentdb@ds=eleme_haihua
+POSTHOOK: query: ALTER TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb partition(ds='eleme_haihua')
CHANGE COLUMN a a_new BOOLEAN
+POSTHOOK: type: ALTERTABLE_RENAMECOL
+POSTHOOK: Input: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+POSTHOOK: Input: test_db_nocurr@test_table_for_alter_partition_nocurrentdb@ds=eleme_haihua
+POSTHOOK: Output: test_db_nocurr@test_table_for_alter_partition_nocurrentdb@ds=eleme_haihua
+PREHOOK: query: desc extended test_db_nocurr.test_table_for_alter_partition_nocurrentdb partition(ds='eleme_haihua')
+PREHOOK: type: DESCTABLE
+PREHOOK: Input: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+POSTHOOK: query: desc extended test_db_nocurr.test_table_for_alter_partition_nocurrentdb
partition(ds='eleme_haihua')
+POSTHOOK: type: DESCTABLE
+POSTHOOK: Input: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+a_new               	boolean             	                    
+ds                  	string              	                    
+	 	 
+# Partition Information	 	 
+# col_name            	data_type           	comment             
+	 	 
+ds                  	string              	                    
+	 	 
+#### A masked pattern was here ####
+PREHOOK: query: DROP TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+PREHOOK: Output: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+POSTHOOK: query: DROP TABLE test_db_nocurr.test_table_for_alter_partition_nocurrentdb
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+POSTHOOK: Output: test_db_nocurr@test_table_for_alter_partition_nocurrentdb
+PREHOOK: query: DROP DATABASE test_db_nocurr
+PREHOOK: type: DROPDATABASE
+PREHOOK: Input: database:test_db_nocurr
+PREHOOK: Output: database:test_db_nocurr
+POSTHOOK: query: DROP DATABASE test_db_nocurr
+POSTHOOK: type: DROPDATABASE
+POSTHOOK: Input: database:test_db_nocurr
+POSTHOOK: Output: database:test_db_nocurr


Mime
View raw message