Index: ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBridge.java =================================================================== --- ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBridge.java (revision 1129513) +++ ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBridge.java (working copy) @@ -37,10 +37,10 @@ /** * GenericUDFBridge encapsulates UDF to provide the same interface as * GenericUDF. - * + * * Note that GenericUDFBridge implements Serializable because the name of the * UDF class needs to be serialized with the plan. - * + * */ public class GenericUDFBridge extends GenericUDF implements Serializable { /** @@ -61,7 +61,7 @@ /** * Greate a new GenericUDFBridge object. - * + * * @param udfName * The name of the corresponding udf. * @param isOperator @@ -123,6 +123,11 @@ @Override public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException { + if(null == udfClass) + { + throw new UDFArgumentException( + "The UDF Implementation class is null. May be required jar is missing in classpath."); + } udf = (UDF) ReflectionUtils.newInstance(udfClass, null); // Resolve for the method based on argument types Index: ql/src/test/queries/clientnegative/udfnull.q =================================================================== --- ql/src/test/queries/clientnegative/udfnull.q (revision 0) +++ ql/src/test/queries/clientnegative/udfnull.q (revision 0) @@ -0,0 +1,6 @@ + +CREATE TEMPORARY FUNCTION example_arraysum AS 'org.apache.hadoop.hive.contrib.udf.example.UDFExampleArraySum'; + +SELECT example_arraysum(lint)FROM src_thrift; + +DROP TEMPORARY FUNCTION example_arraysum; Index: ql/src/test/results/clientnegative/udfnull.q.out =================================================================== --- ql/src/test/results/clientnegative/udfnull.q.out (revision 0) +++ ql/src/test/results/clientnegative/udfnull.q.out (revision 0) @@ -0,0 +1,9 @@ +PREHOOK: query: CREATE TEMPORARY FUNCTION example_arraysum AS 'org.apache.hadoop.hive.contrib.udf.example.UDFExampleArraySum' +PREHOOK: type: CREATEFUNCTION +POSTHOOK: query: CREATE TEMPORARY FUNCTION example_arraysum AS 'org.apache.hadoop.hive.contrib.udf.example.UDFExampleArraySum' +POSTHOOK: type: CREATEFUNCTION +PREHOOK: query: SELECT example_arraysum(lint)FROM src_thrift +PREHOOK: type: QUERY +PREHOOK: Input: default@src_thrift +PREHOOK: Output: file:/tmp/root/hive_2011-05-25_10-05-57_126_4632621650656424226/-mr-10000 +FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.MapRedTask