public void testLevenshteinWrongType1() throws HiveException { @SuppressWarnings("resource") GenericUDFLevenshtein udf = new GenericUDFLevenshtein(); ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableHiveVarcharObjectInspector; ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.writableFloatObjectInspector; ObjectInspector[] arguments = { valueOI0, valueOI1 }; try { udf.initialize(arguments); assertTrue("levenshtein test. UDFArgumentTypeException is expected", false); } catch (UDFArgumentTypeException e) { assertEquals("levenshtein test", "levenshtein only takes STRING_GROUP, VOID_GROUP types as 2nd argument, got FLOAT", e.getMessage()); } }
public void testSoundexWrongType0() throws HiveException { @SuppressWarnings("resource") GenericUDFSoundex udf = new GenericUDFSoundex(); ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableIntObjectInspector; ObjectInspector[] arguments = { valueOI0 }; try { udf.initialize(arguments); assertTrue("soundex test. UDFArgumentTypeException is expected", false); } catch (UDFArgumentTypeException e) { assertEquals("soundex test", "soundex only takes STRING_GROUP types as 1st argument, got INT", e.getMessage()); } }
public void testLevenshteinWrongType0() throws HiveException { @SuppressWarnings("resource") GenericUDFLevenshtein udf = new GenericUDFLevenshtein(); ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableIntObjectInspector; ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.writableStringObjectInspector; ObjectInspector[] arguments = { valueOI0, valueOI1 }; try { udf.initialize(arguments); assertTrue("levenshtein test. UDFArgumentTypeException is expected", false); } catch (UDFArgumentTypeException e) { assertEquals("levenshtein test", "levenshtein only takes STRING_GROUP, VOID_GROUP types as 1st argument, got INT", e.getMessage()); } }
public void testAddMonthsLong() throws HiveException { @SuppressWarnings("resource") GenericUDFAddMonths udf = new GenericUDFAddMonths(); ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableStringObjectInspector; ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.writableLongObjectInspector; ObjectInspector[] arguments = { valueOI0, valueOI1 }; try { udf.initialize(arguments); assertTrue("add_months exception expected", false); } catch (UDFArgumentTypeException e) { assertEquals("add_months test", "add_months only takes INT/SHORT/BYTE types as 2nd argument, got LONG", e.getMessage()); } }
} catch (UDFArgumentTypeException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT_TYPE.getMsg(expr .getChild(childrenBegin + e.getArgumentId()), e.getMessage()), e); } catch (UDFArgumentLengthException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT_LENGTH.getMsg(
} catch (UDFArgumentTypeException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT_TYPE.getMsg(expr .getChild(childrenBegin + e.getArgumentId()), e.getMessage()), e); } catch (UDFArgumentLengthException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT_LENGTH.getMsg(
} catch (UDFArgumentTypeException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT_TYPE.getMsg(expr .getChild(childrenBegin + e.getArgumentId()), e.getMessage())); } catch (UDFArgumentLengthException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT_LENGTH.getMsg(
} catch (UDFArgumentTypeException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT_TYPE.getMsg(expr .getChild(childrenBegin + e.getArgumentId()), e.getMessage())); } catch (UDFArgumentLengthException e) { throw new SemanticException(ErrorMsg.INVALID_ARGUMENT_LENGTH.getMsg(