You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by pv...@apache.org on 2019/02/08 15:19:38 UTC

[hive] branch master updated: HIVE-21227: HIVE-20776 causes view access regression (Na Li reviewed by Karthik Manamcheri and Peter Vary)

This is an automated email from the ASF dual-hosted git repository.

pvary pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new d6a783a  HIVE-21227: HIVE-20776 causes view access regression (Na Li reviewed by Karthik Manamcheri and Peter Vary)
d6a783a is described below

commit d6a783afee687312e6ecf5f3a9c0d6df8fa60896
Author: Na Li <li...@cloudera.com>
AuthorDate: Fri Feb 8 16:18:41 2019 +0100

    HIVE-21227: HIVE-20776 causes view access regression (Na Li reviewed by Karthik Manamcheri and Peter Vary)
---
 .../hadoop/hive/metastore/HiveMetaStoreClient.java |  5 ++++-
 .../hadoop/hive/metastore/TestFilterHooks.java     | 26 +++++++++++++++-------
 2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index a1826fa..fcd0d44 100644
--- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -2506,8 +2506,11 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
   private void checkDbAndTableFilters(final String catName, final String dbName, final String tblName)
       throws NoSuchObjectException, MetaException {
 
+    // HIVE-20776 causes view access regression
+    // Therefore, do not do filtering here. Call following function only to check
+    // if dbName and tblName is valid
     FilterUtils.checkDbAndTableFilters(
-        isClientFilterEnabled, filterHook, catName, dbName, tblName);
+        false, filterHook, catName, dbName, tblName);
   }
 
   @Override
diff --git a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestFilterHooks.java b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestFilterHooks.java
index 6a0d0aa..49c7d88 100644
--- a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestFilterHooks.java
+++ b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestFilterHooks.java
@@ -278,7 +278,7 @@ public class TestFilterHooks {
 
     testFilterForDb(true);
     testFilterForTables(true);
-    testFilterForPartition();
+    testFilterForPartition(true);
   }
 
   /**
@@ -321,7 +321,7 @@ public class TestFilterHooks {
 
     testFilterForDb(false);
     testFilterForTables(false);
-    testFilterForPartition();
+    testFilterForPartition(false);
   }
 
   protected void testFilterForDb(boolean filterAtServer) throws Exception {
@@ -360,7 +360,7 @@ public class TestFilterHooks {
     assertEquals(0, client.getTables(DBNAME1, TAB2).size());
   }
 
-  protected void testFilterForPartition() throws Exception {
+  protected void testFilterForPartition(boolean filterAtServer) throws Exception {
     try {
       assertNotNull(client.getPartition(DBNAME1, TAB2, "name=value1"));
       fail("getPartition() should fail with blocking mode");
@@ -368,11 +368,21 @@ public class TestFilterHooks {
       // Excepted
     }
 
-    try {
-      client.getPartitionsByNames(DBNAME1, TAB2,
-          Lists.newArrayList("name=value1")).size();
-    } catch (NoSuchObjectException e) {
-      // Excepted
+    if (filterAtServer) {
+      // at HMS server, the table of the partitions should be filtered out and result in
+      // NoSuchObjectException
+      try {
+        client.getPartitionsByNames(DBNAME1, TAB2,
+            Lists.newArrayList("name=value1")).size();
+        fail("getPartitionsByNames() should fail with blocking mode at server side");
+      } catch (NoSuchObjectException e) {
+        // Excepted
+      }
+    } else {
+      // at HMS client, we cannot filter the table of the partitions due to
+      // HIVE-21227: HIVE-20776 causes view access regression
+      assertEquals(0, client.getPartitionsByNames(DBNAME1, TAB2,
+          Lists.newArrayList("name=value1")).size());
     }
   }
 }