sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shreepa...@apache.org
Subject git commit: SENTRY-63: Hive queries with temporary UDF return error UnsupportedOperationException (Prasad Mujumdar via Shreepadma Venugopalan)
Date Thu, 14 Nov 2013 23:53:32 GMT
Updated Branches:
  refs/heads/master dc3a62145 -> 68998d011


SENTRY-63: Hive queries with temporary UDF return error UnsupportedOperationException (Prasad
Mujumdar via Shreepadma Venugopalan)


Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/68998d01
Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/68998d01
Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/68998d01

Branch: refs/heads/master
Commit: 68998d011b58c089a419e047962f8fc2a7ca361c
Parents: dc3a621
Author: Shreepadma Venugopalan <shreepadma@apache.org>
Authored: Thu Nov 14 15:53:03 2013 -0800
Committer: Shreepadma Venugopalan <shreepadma@apache.org>
Committed: Thu Nov 14 15:53:03 2013 -0800

----------------------------------------------------------------------
 .../apache/sentry/binding/hive/HiveAuthzBindingHook.java  | 10 ++++++++--
 .../tests/e2e/hive/TestPrivilegesAtFunctionScope.java     |  2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/68998d01/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
index 5395c50..7f9560f 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
@@ -384,8 +384,10 @@ implements HiveDriverFilterHook {
         }
         // If this is a UDF, then check whether its allowed to be executed
         // TODO: when we support execute privileges on UDF, this can be removed.
-        if (isBuiltinUDF(readEntity)) {
-          checkUDFWhiteList(readEntity.getUDF().getDisplayName());
+        if (isUDF(readEntity)) {
+          if (isBuiltinUDF(readEntity)) {
+            checkUDFWhiteList(readEntity.getUDF().getDisplayName());
+          }
           continue;
         }
         List<DBModelAuthorizable> entityHierarchy = new ArrayList<DBModelAuthorizable>();
@@ -455,6 +457,10 @@ implements HiveDriverFilterHook {
     hiveAuthzBinding.set(context.getConf());
   }
 
+  private boolean isUDF(ReadEntity readEntity) {
+    return readEntity.getType().equals(Type.UDF);
+  }
+  
   private boolean isBuiltinUDF(ReadEntity readEntity) {
     return readEntity.getType().equals(Type.UDF) &&
         readEntity.getUDF().isNative();

http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/68998d01/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
----------------------------------------------------------------------
diff --git a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
index 62e206a..92c1dd4 100644
--- a/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
+++ b/sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hive/TestPrivilegesAtFunctionScope.java
@@ -101,6 +101,7 @@ public class TestPrivilegesAtFunctionScope extends AbstractTestWithStaticConfigu
     statement.execute("USE " + dbName1);
     statement.execute(
         "CREATE TEMPORARY FUNCTION printf_test AS 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFPrintf'");
+    statement.execute("SELECT printf_test(value) FROM " + tableName1);
     statement.execute("DROP TEMPORARY FUNCTION printf_test");
     context.close();
 
@@ -110,6 +111,7 @@ public class TestPrivilegesAtFunctionScope extends AbstractTestWithStaticConfigu
     statement.execute("USE " + dbName1);
     statement.execute(
         "CREATE TEMPORARY FUNCTION printf_test_2 AS 'org.apache.hadoop.hive.ql.udf.generic.GenericUDFPrintf'");
+    statement.execute("SELECT printf_test_2(value) FROM " + tableName1);
     statement.execute("DROP TEMPORARY FUNCTION printf_test");
     context.close();
 


Mime
View raw message