Search in sources :

Example 1 with GenericUDFLpad

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);
}
Also used : ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) GenericUDFLpad(org.apache.hadoop.hive.ql.udf.generic.GenericUDFLpad)

Aggregations

GenericUDFLpad (org.apache.hadoop.hive.ql.udf.generic.GenericUDFLpad)1 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)1