FAQ
Repository: hive
Updated Branches:
   refs/heads/branch-1 9be86f3f4 -> f42b984bd


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/f42b984b
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/f42b984b
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/f42b984b

Branch: refs/heads/branch-1
Commit: f42b984bd49ec8b210aa0ee4f9be83bed779ec96
Parents: 9be86f3
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:43:44 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/f42b984b/itests/src/test/resources/testconfiguration.properties
----------------------------------------------------------------------
diff --git a/itests/src/test/resources/testconfiguration.properties b/itests/src/test/resources/testconfiguration.properties
index 5a391a1..3229c44 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -412,7 +412,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/f42b984b/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 f98726d..ea73a78 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
@@ -1774,7 +1774,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/f42b984b/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/f42b984b/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

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupcommits @
categorieshive, hadoop
postedApr 17, '16 at 5:42a
activeApr 17, '16 at 5:50a
posts2
users1
websitehive.apache.org

1 user in discussion

Ychena: 2 posts

People

Translate

site design / logo © 2021 Grokbase