Repository: incubator-sentry Updated Branches: refs/heads/master ef9b73884 -> 0f0fd359b
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/0f0fd359 Tree: http://git-wip-us.apache.org/repos/asf/incubator-sentry/tree/0f0fd359 Diff: http://git-wip-us.apache.org/repos/asf/incubator-sentry/diff/0f0fd359 Branch: refs/heads/master Commit: 0f0fd359b17f3460c5254fbd617c5f417a2f2d6b Parents: ef9b738 Author: Anne Yu <[email protected]> Authored: Mon Jan 25 13:32:01 2016 -0800 Committer: Anne Yu <[email protected]> Committed: Mon Jan 25 13:33:56 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/0f0fd359/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 9c1eff7..ee00889 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 @@ -38,6 +38,7 @@ import org.apache.hadoop.hive.ql.exec.FunctionRegistry; import org.apache.hadoop.hive.ql.exec.SentryFilterDDLTask; 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; @@ -236,7 +237,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); } @@ -247,7 +250,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;
