diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionTask.java ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionTask.java index 5c6ea07..70b6f57 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionTask.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionTask.java @@ -95,9 +95,12 @@ public class FunctionTask extends Task { .newInstance(udfClass, null)); return 0; } + console.printError("FAILED: Class " + createFunctionDesc.getClassName() + + " does not implement UDF, GenericUDF, or UDAF"); return 1; } catch (ClassNotFoundException e) { + console.printError("FAILED: Class " + createFunctionDesc.getClassName() + " not found"); LOG.info("create function: " + StringUtils.stringifyException(e)); return 1; } diff --git ql/src/test/queries/clientnegative/udf_function_does_not_exist.q ql/src/test/queries/clientnegative/udf_function_does_not_exist.q new file mode 100644 index 0000000..e3f3bae --- /dev/null +++ ql/src/test/queries/clientnegative/udf_function_does_not_exist.q @@ -0,0 +1 @@ +CREATE TEMPORARY FUNCTION moo AS 'moo'; diff --git ql/src/test/queries/clientnegative/udf_function_does_not_implement_udf.q ql/src/test/queries/clientnegative/udf_function_does_not_implement_udf.q new file mode 100644 index 0000000..21ca6e7 --- /dev/null +++ ql/src/test/queries/clientnegative/udf_function_does_not_implement_udf.q @@ -0,0 +1 @@ +CREATE TEMPORARY FUNCTION moo AS 'org.apache.hadoop.hive.ql.Driver'; diff --git ql/src/test/results/clientnegative/udf_function_does_not_exist.q.out ql/src/test/results/clientnegative/udf_function_does_not_exist.q.out new file mode 100644 index 0000000..8a51d52 --- /dev/null +++ ql/src/test/results/clientnegative/udf_function_does_not_exist.q.out @@ -0,0 +1,4 @@ +PREHOOK: query: CREATE TEMPORARY FUNCTION moo AS 'moo' +PREHOOK: type: CREATEFUNCTION +FAILED: Class moo not found +FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.FunctionTask diff --git ql/src/test/results/clientnegative/udf_function_does_not_implement_udf.q.out ql/src/test/results/clientnegative/udf_function_does_not_implement_udf.q.out new file mode 100644 index 0000000..9ea8668 --- /dev/null +++ ql/src/test/results/clientnegative/udf_function_does_not_implement_udf.q.out @@ -0,0 +1,4 @@ +PREHOOK: query: CREATE TEMPORARY FUNCTION moo AS 'org.apache.hadoop.hive.ql.Driver' +PREHOOK: type: CREATEFUNCTION +FAILED: Class org.apache.hadoop.hive.ql.Driver does not implement UDF, GenericUDF, or UDAF +FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.FunctionTask