You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2015/05/26 19:19:26 UTC

hive git commit: HIVE-10801 : 'drop view' fails throwing java.lang.NullPointerException (Hari Subramaniyan, reviewed by Eugene Koifman)

Repository: hive
Updated Branches:
  refs/heads/master a00bf4f87 -> cbd09253d


HIVE-10801 : 'drop view' fails throwing java.lang.NullPointerException (Hari Subramaniyan, reviewed by Eugene Koifman)


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

Branch: refs/heads/master
Commit: cbd09253d6178dcd2f5f4043644570769dd52453
Parents: a00bf4f
Author: Hari Subramaniyan <ha...@apache.org>
Authored: Tue May 26 10:19:03 2015 -0700
Committer: Hari Subramaniyan <ha...@apache.org>
Committed: Tue May 26 10:19:03 2015 -0700

----------------------------------------------------------------------
 .../test/resources/testconfiguration.properties |  3 +-
 .../hadoop/hive/metastore/HiveMetaStore.java    |  3 +-
 .../clientpositive/encryption_drop_view.q       |  6 ++++
 .../encrypted/encryption_drop_view.q.out        | 34 ++++++++++++++++++++
 4 files changed, 44 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/cbd09253/itests/src/test/resources/testconfiguration.properties
----------------------------------------------------------------------
diff --git a/itests/src/test/resources/testconfiguration.properties b/itests/src/test/resources/testconfiguration.properties
index b7c7e03..ae03283 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -352,7 +352,8 @@ encrypted.query.files=encryption_join_unencrypted_tbl.q,\
   encryption_unencrypted_nonhdfs_external_tables.q \
   encryption_move_tbl.q \
   encryption_drop_table.q \
-  encryption_insert_values.q
+  encryption_insert_values.q \
+  encryption_drop_view.q
 
 beeline.positive.exclude=add_part_exist.q,\
   alter1.q,\

http://git-wip-us.apache.org/repos/asf/hive/blob/cbd09253/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index 5d8718c..d81c856 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -1535,7 +1535,8 @@ public class HiveMetaStore extends ThriftHiveMetastore {
           }
         }
 
-        if(!ifPurge) {
+        // tblPath will be null when tbl is a view. We skip the following if block in that case.
+        if(tblPath != null && !ifPurge) {
           String trashInterval = hiveConf.get("fs.trash.interval");
           boolean trashEnabled = trashInterval != null && trashInterval.length() > 0
             && Float.parseFloat(trashInterval) > 0;

http://git-wip-us.apache.org/repos/asf/hive/blob/cbd09253/ql/src/test/queries/clientpositive/encryption_drop_view.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/encryption_drop_view.q b/ql/src/test/queries/clientpositive/encryption_drop_view.q
new file mode 100644
index 0000000..911583a
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/encryption_drop_view.q
@@ -0,0 +1,6 @@
+DROP TABLE IF EXISTS dve_encrypted_table PURGE;
+CREATE TABLE dve_encrypted_table (key INT, value STRING) LOCATION '${hiveconf:hive.metastore.warehouse.dir}/default/dve_encrypted_table';
+CRYPTO CREATE_KEY --keyName key_128 --bitLength 128;
+CRYPTO CREATE_ZONE --keyName key_128 --path ${hiveconf:hive.metastore.warehouse.dir}/default/dve_encrypted_table;
+CREATE VIEW dve_view AS SELECT * FROM dve_encrypted_table;
+DROP VIEW dve_view;

http://git-wip-us.apache.org/repos/asf/hive/blob/cbd09253/ql/src/test/results/clientpositive/encrypted/encryption_drop_view.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/encrypted/encryption_drop_view.q.out b/ql/src/test/results/clientpositive/encrypted/encryption_drop_view.q.out
new file mode 100644
index 0000000..7958b39
--- /dev/null
+++ b/ql/src/test/results/clientpositive/encrypted/encryption_drop_view.q.out
@@ -0,0 +1,34 @@
+PREHOOK: query: DROP TABLE IF EXISTS dve_encrypted_table PURGE
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE IF EXISTS dve_encrypted_table PURGE
+POSTHOOK: type: DROPTABLE
+#### A masked pattern was here ####
+PREHOOK: type: CREATETABLE
+#### A masked pattern was here ####
+PREHOOK: Output: database:default
+PREHOOK: Output: default@dve_encrypted_table
+#### A masked pattern was here ####
+POSTHOOK: type: CREATETABLE
+#### A masked pattern was here ####
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@dve_encrypted_table
+Encryption key created: 'key_128'
+Encryption zone created: '/build/ql/test/data/warehouse/default/dve_encrypted_table' using key: 'key_128'
+PREHOOK: query: CREATE VIEW dve_view AS SELECT * FROM dve_encrypted_table
+PREHOOK: type: CREATEVIEW
+PREHOOK: Input: default@dve_encrypted_table
+PREHOOK: Output: database:default
+PREHOOK: Output: default@dve_view
+POSTHOOK: query: CREATE VIEW dve_view AS SELECT * FROM dve_encrypted_table
+POSTHOOK: type: CREATEVIEW
+POSTHOOK: Input: default@dve_encrypted_table
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@dve_view
+PREHOOK: query: DROP VIEW dve_view
+PREHOOK: type: DROPVIEW
+PREHOOK: Input: default@dve_view
+PREHOOK: Output: default@dve_view
+POSTHOOK: query: DROP VIEW dve_view
+POSTHOOK: type: DROPVIEW
+POSTHOOK: Input: default@dve_view
+POSTHOOK: Output: default@dve_view