use of org.apache.hadoop.hive.serde2.io.DoubleWritable in project hive by apache.
the class TestStreamingSum method sumDouble.
public void sumDouble(Iterator<Double> inVals, int inSz, int numPreceding, int numFollowing, Iterator<Double> outVals) throws HiveException {
GenericUDAFSum fnR = new GenericUDAFSum();
TypeInfo[] inputTypes = { TypeInfoFactory.doubleTypeInfo };
ObjectInspector[] inputOIs = { PrimitiveObjectInspectorFactory.writableDoubleObjectInspector };
DoubleWritable[] in = new DoubleWritable[1];
in[0] = new DoubleWritable();
_agg(fnR, inputTypes, inVals, TypeHandler.DoubleHandler, in, inputOIs, inSz, numPreceding, numFollowing, outVals);
}
use of org.apache.hadoop.hive.serde2.io.DoubleWritable in project hive by apache.
the class TestGenericUDFAbs method testDouble.
public void testDouble() throws HiveException {
GenericUDFAbs udf = new GenericUDFAbs();
ObjectInspector valueOI = PrimitiveObjectInspectorFactory.writableDoubleObjectInspector;
ObjectInspector[] arguments = { valueOI };
udf.initialize(arguments);
DeferredObject valueObj = new DeferredJavaObject(new DoubleWritable(107.78));
DeferredObject[] args = { valueObj };
DoubleWritable output = (DoubleWritable) udf.evaluate(args);
assertEquals("abs() test for Double failed ", 107.78, output.get());
valueObj = new DeferredJavaObject(new DoubleWritable(-107.78));
args[0] = valueObj;
output = (DoubleWritable) udf.evaluate(args);
assertEquals("abs() test for Double failed ", 107.78, output.get());
}
use of org.apache.hadoop.hive.serde2.io.DoubleWritable in project hive by apache.
the class TestUDFMath method testAcos.
@Test
public void testAcos() throws HiveException {
UDFAcos udf = new UDFAcos();
input = createDecimal("0.716");
DoubleWritable res = udf.evaluate(input);
Assert.assertEquals(0.7727408115633954, res.get(), 0.000001);
}
use of org.apache.hadoop.hive.serde2.io.DoubleWritable in project hive by apache.
the class TestUDFMath method testLog10.
@Test
public void testLog10() throws HiveException {
UDFLog10 udf = new UDFLog10();
input = createDecimal("100.0");
DoubleWritable res = udf.evaluate(input);
Assert.assertEquals(2.0, res.get(), 0.000001);
}
use of org.apache.hadoop.hive.serde2.io.DoubleWritable in project hive by apache.
the class TestUDFMath method testSqrt.
@Test
public void testSqrt() throws HiveException {
UDFSqrt udf = new UDFSqrt();
input = createDecimal("49.0");
DoubleWritable res = udf.evaluate(input);
Assert.assertEquals(7.0, res.get(), 0.000001);
}
Aggregations