You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by sz...@apache.org on 2018/08/30 09:22:33 UTC
hive git commit: HIVE-20466: Improve
org.apache.hadoop.hive.ql.exec.FunctionTask Experience (denys kuzmenko,
reviewed by Peter Vary and Adam Szita)
Repository: hive
Updated Branches:
refs/heads/master b8d82844b -> a77e0468f
HIVE-20466: Improve org.apache.hadoop.hive.ql.exec.FunctionTask Experience (denys kuzmenko, reviewed by Peter Vary and Adam Szita)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/a77e0468
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/a77e0468
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/a77e0468
Branch: refs/heads/master
Commit: a77e0468f9a1be37939a5c2cc5ed8030ea1058e0
Parents: b8d8284
Author: denys kuzmenko <dk...@cloudera.com>
Authored: Thu Aug 30 11:06:48 2018 +0200
Committer: Adam Szita <sz...@cloudera.com>
Committed: Thu Aug 30 11:21:02 2018 +0200
----------------------------------------------------------------------
.../apache/hadoop/hive/ql/exec/FunctionRegistry.java | 2 +-
.../java/org/apache/hadoop/hive/ql/exec/Registry.java | 12 +++++++++---
.../create_function_nonexistent_class.q.out | 4 ++--
3 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/a77e0468/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
index 4459184..8bf0a9c 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
@@ -1678,7 +1678,7 @@ public final class FunctionRegistry {
}
public static FunctionInfo registerPermanentFunction(String functionName,
- String className, boolean registerToSession, FunctionResource[] resources) {
+ String className, boolean registerToSession, FunctionResource[] resources) throws SemanticException {
return system.registerPermanentFunction(functionName, className, registerToSession, resources);
}
http://git-wip-us.apache.org/repos/asf/hive/blob/a77e0468/ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java
index 6f8a8f5..7c0efc4 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java
@@ -269,7 +269,7 @@ public class Registry {
}
public FunctionInfo registerPermanentFunction(String functionName,
- String className, boolean registerToSession, FunctionResource... resources) {
+ String className, boolean registerToSession, FunctionResource... resources) throws SemanticException {
FunctionInfo function = new FunctionInfo(functionName, className, resources);
// register to session first for backward compatibility
if (registerToSession) {
@@ -652,7 +652,7 @@ public class Registry {
}
// should be called after session registry is checked
- private FunctionInfo registerToSessionRegistry(String qualifiedName, FunctionInfo function) {
+ private FunctionInfo registerToSessionRegistry(String qualifiedName, FunctionInfo function) throws SemanticException {
FunctionInfo ret = null;
ClassLoader prev = Utilities.getSessionSpecifiedClassLoader();
try {
@@ -682,8 +682,14 @@ public class Registry {
// Lookup of UDf class failed
LOG.error("Unable to load UDF class: " + e);
Utilities.restoreSessionSpecifiedClassLoader(prev);
+
+ throw new SemanticException("Unable to load UDF class: " + e +
+ "\nPlease ensure that the JAR file containing this class has been properly installed " +
+ "in the auxiliary directory or was added with ADD JAR command.");
+ }finally {
+ function.shareStateWith(ret);
}
- function.shareStateWith(ret);
+
return ret;
}
http://git-wip-us.apache.org/repos/asf/hive/blob/a77e0468/ql/src/test/results/clientnegative/create_function_nonexistent_class.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/create_function_nonexistent_class.q.out b/ql/src/test/results/clientnegative/create_function_nonexistent_class.q.out
index 77467f6..55e66f8 100644
--- a/ql/src/test/results/clientnegative/create_function_nonexistent_class.q.out
+++ b/ql/src/test/results/clientnegative/create_function_nonexistent_class.q.out
@@ -2,5 +2,5 @@ PREHOOK: query: create function default.badfunc as 'my.nonexistent.class'
PREHOOK: type: CREATEFUNCTION
PREHOOK: Output: database:default
PREHOOK: Output: default.badfunc
-Failed to register default.badfunc using class my.nonexistent.class
-FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.FunctionTask
+FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.FunctionTask. Unable to load UDF class: java.lang.ClassNotFoundException: my.nonexistent.class
+Please ensure that the JAR file containing this class has been properly installed in the auxiliary directory or was added with ADD JAR command.