use of org.apache.hadoop.hive.ql.udf.generic.GenericUDFLpad in project hive by apache.
the class TestGenericUDFLpad method testLpad.
public void testLpad() throws HiveException {
GenericUDFLpad udf = new GenericUDFLpad();
ObjectInspector valueOI1 = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
ObjectInspector valueOI2 = PrimitiveObjectInspectorFactory.writableIntObjectInspector;
ObjectInspector valueOI3 = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
ObjectInspector[] arguments = { valueOI1, valueOI2, valueOI3 };
udf.initialize(arguments);
runAndVerify("hi", 5, "??", "???hi", udf);
runAndVerify("hi", 1, "??", "h", udf);
runAndVerify("hi", 5, "??", "???hi", udf);
runAndVerify("hi", 1, "??", "h", udf);
runAndVerify("hi", 3, "", null, udf);
}
Aggregations