/** * Constructor. * * @param funcClass * The UDF or UDAF class. * @param argTypeInfos * The list of argument types that lead to an ambiguity. * @param methods * All potential matches. */ public UDFArgumentException(String message, Class<?> funcClass, List<TypeInfo> argTypeInfos, List<Method> methods) { super(getMessage(message, funcClass, argTypeInfos, methods)); this.funcClass = funcClass; this.argTypeInfos = argTypeInfos; this.methods = methods; }
/** * Constructor. * * @param funcClass * The UDF or UDAF class. * @param argTypeInfos * The list of argument types that lead to an ambiguity. * @param methods * All potential matches. */ public UDFArgumentException(String message, Class<?> funcClass, List<TypeInfo> argTypeInfos, List<Method> methods) { super(getMessage(message, funcClass, argTypeInfos, methods)); this.funcClass = funcClass; this.argTypeInfos = argTypeInfos; this.methods = methods; }
public void testNextDayErrorArg1() throws HiveException { @SuppressWarnings("resource") GenericUDFNextDay udf = new GenericUDFNextDay(); ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableLongObjectInspector; ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.writableStringObjectInspector; ObjectInspector[] arguments = { valueOI0, valueOI1 }; try { udf.initialize(arguments); assertTrue("UDFArgumentException expected", false); } catch (UDFArgumentException e) { assertEquals( "next_day only takes STRING_GROUP, DATE_GROUP, VOID_GROUP types as 1st argument, got LONG", e.getMessage()); } }
public void testNextDayErrorArg2() throws HiveException { @SuppressWarnings("resource") GenericUDFNextDay udf = new GenericUDFNextDay(); ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableStringObjectInspector; ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.writableIntObjectInspector; ObjectInspector[] arguments = { valueOI0, valueOI1 }; try { udf.initialize(arguments); assertTrue("UDFArgumentException expected", false); } catch (UDFArgumentException e) { assertEquals("next_day only takes STRING_GROUP, VOID_GROUP types as 2nd argument, got INT", e.getMessage()); } }
public void testVoidToDate() throws HiveException { GenericUDFDate udf = new GenericUDFDate(); ObjectInspector valueOI = PrimitiveObjectInspectorFactory.writableVoidObjectInspector; ObjectInspector[] arguments = {valueOI}; udf.initialize(arguments); DeferredObject[] args = { new DeferredJavaObject(null) }; DateWritableV2 output = (DateWritableV2) udf.evaluate(args); // Try with null VOID assertNull("to_date() with null DATE ", output); // Try with erroneously generated VOID DeferredObject[] junkArgs = { new DeferredJavaObject(new Text("2015-11-22")) }; try { udf.evaluate(junkArgs); fail("to_date() test with VOID non-null failed"); } catch (UDFArgumentException udfae) { assertEquals("TO_DATE() received non-null object of VOID type", udfae.getMessage()); } }
} catch (UDFArgumentException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT.getMsg(expr, e .getMessage()), e);
} catch (UDFArgumentException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT.getMsg(expr, e .getMessage()), e);
/** * Constructor. * * @param funcClass * The UDF or UDAF class. * @param argTypeInfos * The list of argument types that lead to an ambiguity. * @param methods * All potential matches. */ public UDFArgumentException(String message, Class<?> funcClass, List<TypeInfo> argTypeInfos, List<Method> methods) { super(getMessage(message, funcClass, argTypeInfos, methods)); this.funcClass = funcClass; this.argTypeInfos = argTypeInfos; this.methods = methods; }
/** * Constructor. * * @param funcClass * The UDF or UDAF class. * @param argTypeInfos * The list of argument types that lead to an ambiguity. * @param methods * All potential matches. */ public UDFArgumentException(String message, Class<?> funcClass, List<TypeInfo> argTypeInfos, List<Method> methods) { super(getMessage(message, funcClass, argTypeInfos, methods)); this.funcClass = funcClass; this.argTypeInfos = argTypeInfos; this.methods = methods; }
} catch (UDFArgumentException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT.getMsg(expr, e .getMessage()));
} catch (UDFArgumentException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT.getMsg(expr, e .getMessage()));