Repository: incubator-sentry Updated Branches: refs/heads/branch-1.5.1 d9ee8ade7 -> 3f44f8145
SENTRY-1003: Support "reload" by updating the classpath of Sentry function aux jar path during runtime. (Dapeng Sun via Anne Yu) Project: http://git-wip-us.apache.org/repos/asf/incubator-sentry/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sentry/commit/3f44f814 Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/3f44f814 Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/3f44f814 Branch: refs/heads/branch-1.5.1 Commit: 3f44f81456519c2af899a049f18846e35fe60ae0 Parents: d9ee8ad Author: Anne Yu <[email protected]> Authored: Mon Jan 25 13:32:01 2016 -0800 Committer: Anne Yu <[email protected]> Committed: Mon Jan 25 13:36:55 2016 -0800 ---------------------------------------------------------------------- .../org/apache/sentry/binding/hive/HiveAuthzBindingHook.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/3f44f814/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 48afa08..e2ea432 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 @@ -33,6 +33,7 @@ import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.conf.HiveConf.ConfVars; import org.apache.hadoop.hive.ql.exec.SentryGrantRevokeTask; import org.apache.hadoop.hive.ql.exec.Task; +import org.apache.hadoop.hive.ql.exec.Utilities; import org.apache.hadoop.hive.ql.hooks.Entity; import org.apache.hadoop.hive.ql.hooks.Entity.Type; import org.apache.hadoop.hive.ql.hooks.Hook; @@ -218,7 +219,9 @@ public class HiveAuthzBindingHook extends AbstractSemanticAnalyzerHook { case HiveParser.TOK_CREATEFUNCTION: String udfClassName = BaseSemanticAnalyzer.unescapeSQLString(ast.getChild(1).getText()); try { - CodeSource udfSrc = Class.forName(udfClassName).getProtectionDomain().getCodeSource(); + CodeSource udfSrc = + Class.forName(udfClassName, true, Utilities.getSessionSpecifiedClassLoader()) + .getProtectionDomain().getCodeSource(); if (udfSrc == null) { throw new SemanticException("Could not resolve the jar for UDF class " + udfClassName); } @@ -229,7 +232,7 @@ public class HiveAuthzBindingHook extends AbstractSemanticAnalyzerHook { } udfURI = parseURI(udfSrc.getLocation().toString(), true); } catch (ClassNotFoundException e) { - throw new SemanticException("Error retrieving udf class", e); + throw new SemanticException("Error retrieving udf class:" + e.getMessage(), e); } // create/drop function is allowed with any database currDB = Database.ALL;
