use of org.apache.hadoop.hive.ql.udf.generic.GenericUDFAbs in project hive by apache.
the class TestGenericUDFAbs method testLong.
public void testLong() throws HiveException {
GenericUDFAbs udf = new GenericUDFAbs();
ObjectInspector valueOI = PrimitiveObjectInspectorFactory.writableLongObjectInspector;
ObjectInspector[] arguments = { valueOI };
udf.initialize(arguments);
DeferredObject valueObj = new DeferredJavaObject(new LongWritable(107L));
DeferredObject[] args = { valueObj };
LongWritable output = (LongWritable) udf.evaluate(args);
assertEquals("abs() test for LONG failed ", 107, output.get());
valueObj = new DeferredJavaObject(new LongWritable(-107L));
args[0] = valueObj;
output = (LongWritable) udf.evaluate(args);
assertEquals("abs() test for LONG failed ", 107, output.get());
}
Aggregations