Search in sources :

Example 1 with GenericUDFRTrim

use of org.apache.hadoop.hive.ql.udf.generic.GenericUDFRTrim in project hive by apache.

the class TestGenericUDFRTrim method testTrim.

public void testTrim() throws HiveException {
    GenericUDFRTrim udf = new GenericUDFRTrim();
    ObjectInspector valueOI = PrimitiveObjectInspectorFactory.writableStringObjectInspector;
    ObjectInspector[] arguments = { valueOI };
    udf.initialize(arguments);
    runAndVerify(" Hello World! ", " Hello World!", udf);
    runAndVerify("Hello World! ", "Hello World!", udf);
    runAndVerify(" Hello World!", " Hello World!", udf);
    runAndVerify("Hello World!", "Hello World!", udf);
    runAndVerify("   ", "", udf);
}
Also used : GenericUDFRTrim(org.apache.hadoop.hive.ql.udf.generic.GenericUDFRTrim) ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)

Aggregations

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