hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ych...@apache.org
Subject hive git commit: HIVE-11427: Location of temporary table for CREATE TABLE SELECT broken by HIVE-7079. (Yongzhi Chen, reviewed by Sergio Pena)
Date Sun, 17 Apr 2016 05:42:39 GMT
Repository: hive
Updated Branches:
  refs/heads/master 68dc9ddd3 -> cc3544bd8


HIVE-11427: Location of temporary table for CREATE TABLE SELECT broken by HIVE-7079. (Yongzhi
Chen, reviewed by Sergio Pena)


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

Branch: refs/heads/master
Commit: cc3544bd893ce758a23b8d52e9c44bb4f80f14ad
Parents: 68dc9dd
Author: Yongzhi Chen <ychena@apache.org>
Authored: Tue Apr 12 13:33:43 2016 -0400
Committer: Yongzhi Chen <ychena@apache.org>
Committed: Sun Apr 17 01:35:22 2016 -0400

----------------------------------------------------------------------
 .../test/resources/testconfiguration.properties |  3 +-
 .../hadoop/hive/ql/parse/SemanticAnalyzer.java  |  7 ++-
 .../queries/clientpositive/encryption_ctas.q    | 16 ++++++
 .../encrypted/encryption_ctas.q.out             | 56 ++++++++++++++++++++
 4 files changed, 80 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/cc3544bd/itests/src/test/resources/testconfiguration.properties
----------------------------------------------------------------------
diff --git a/itests/src/test/resources/testconfiguration.properties b/itests/src/test/resources/testconfiguration.properties
index 889884c..e46e6ce 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -522,7 +522,8 @@ encrypted.query.files=encryption_join_unencrypted_tbl.q,\
   encryption_insert_values.q \
   encryption_drop_view.q \
   encryption_drop_partition.q \
-  encryption_with_trash.q
+  encryption_with_trash.q \
+  encryption_ctas.q
 
 beeline.positive.exclude=add_part_exist.q,\
   alter1.q,\

http://git-wip-us.apache.org/repos/asf/hive/blob/cc3544bd/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 329c617..96df189 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -2073,7 +2073,12 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
               Path location;
               try {
                 Warehouse wh = new Warehouse(conf);
-                location = wh.getDatabasePath(db.getDatabase(names[0]));
+                //Use destination table's db location.
+                String destTableDb = qb.getTableDesc() != null? qb.getTableDesc().getDatabaseName():
null;
+                if (destTableDb == null) {
+                  destTableDb = names[0];
+                }
+                location = wh.getDatabasePath(db.getDatabase(destTableDb));
               } catch (MetaException e) {
                 throw new SemanticException(e);
               }

http://git-wip-us.apache.org/repos/asf/hive/blob/cc3544bd/ql/src/test/queries/clientpositive/encryption_ctas.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/encryption_ctas.q b/ql/src/test/queries/clientpositive/encryption_ctas.q
new file mode 100644
index 0000000..93058b6
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/encryption_ctas.q
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS testCT.encrypted_tablectas PURGE;
+DROP DATABASE IF EXISTS testCT;
+CREATE DATABASE testCT;
+dfs ${system:test.dfs.mkdir} ${hiveconf:hive.metastore.warehouse.dir}/default/encrypted_tablectas;
+
+CRYPTO CREATE_KEY --keyName key_128 --bitLength 128;
+CRYPTO CREATE_ZONE --keyName key_128 --path ${hiveconf:hive.metastore.warehouse.dir}/default/encrypted_tablectas;
+
+CREATE TABLE testCT.encrypted_tablectas LOCATION '${hiveconf:hive.metastore.warehouse.dir}/default/encrypted_tablectas'
+AS SELECT * from src where key = 100 limit 1;
+
+select * from testCT.encrypted_tablectas;
+
+DROP TABLE testCT.encrypted_tablectas PURGE;
+CRYPTO DELETE_KEY --keyName key_128;
+DROP DATABASE testCT;

http://git-wip-us.apache.org/repos/asf/hive/blob/cc3544bd/ql/src/test/results/clientpositive/encrypted/encryption_ctas.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/encrypted/encryption_ctas.q.out b/ql/src/test/results/clientpositive/encrypted/encryption_ctas.q.out
new file mode 100644
index 0000000..5b503ac
--- /dev/null
+++ b/ql/src/test/results/clientpositive/encrypted/encryption_ctas.q.out
@@ -0,0 +1,56 @@
+PREHOOK: query: DROP TABLE IF EXISTS testCT.encrypted_tablectas PURGE
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE IF EXISTS testCT.encrypted_tablectas PURGE
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: DROP DATABASE IF EXISTS testCT
+PREHOOK: type: DROPDATABASE
+POSTHOOK: query: DROP DATABASE IF EXISTS testCT
+POSTHOOK: type: DROPDATABASE
+PREHOOK: query: CREATE DATABASE testCT
+PREHOOK: type: CREATEDATABASE
+PREHOOK: Output: database:testCT
+POSTHOOK: query: CREATE DATABASE testCT
+POSTHOOK: type: CREATEDATABASE
+POSTHOOK: Output: database:testCT
+Encryption key created: 'key_128'
+Encryption zone created: '/build/ql/test/data/warehouse/default/encrypted_tablectas' using
key: 'key_128'
+#### A masked pattern was here ####
+AS SELECT * from src where key = 100 limit 1
+PREHOOK: type: CREATETABLE_AS_SELECT
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+PREHOOK: Output: database:testct
+PREHOOK: Output: testCT@encrypted_tablectas
+#### A masked pattern was here ####
+AS SELECT * from src where key = 100 limit 1
+POSTHOOK: type: CREATETABLE_AS_SELECT
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: Output: database:testct
+POSTHOOK: Output: testCT@encrypted_tablectas
+PREHOOK: query: select * from testCT.encrypted_tablectas
+PREHOOK: type: QUERY
+PREHOOK: Input: testct@encrypted_tablectas
+#### A masked pattern was here ####
+POSTHOOK: query: select * from testCT.encrypted_tablectas
+POSTHOOK: type: QUERY
+POSTHOOK: Input: testct@encrypted_tablectas
+#### A masked pattern was here ####
+100	val_100
+PREHOOK: query: DROP TABLE testCT.encrypted_tablectas PURGE
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: testct@encrypted_tablectas
+PREHOOK: Output: testct@encrypted_tablectas
+POSTHOOK: query: DROP TABLE testCT.encrypted_tablectas PURGE
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: testct@encrypted_tablectas
+POSTHOOK: Output: testct@encrypted_tablectas
+Encryption key deleted: 'key_128'
+PREHOOK: query: DROP DATABASE testCT
+PREHOOK: type: DROPDATABASE
+PREHOOK: Input: database:testct
+PREHOOK: Output: database:testct
+POSTHOOK: query: DROP DATABASE testCT
+POSTHOOK: type: DROPDATABASE
+POSTHOOK: Input: database:testct
+POSTHOOK: Output: database:testct


Mime
View raw message