Search in sources :

Example 1 with GenericUDAFSum

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

the class TestStreamingSum method sumLong.

public void sumLong(Iterator<Long> inVals, int inSz, int numPreceding, int numFollowing, Iterator<Long> outVals) throws HiveException {
    GenericUDAFSum fnR = new GenericUDAFSum();
    TypeInfo[] inputTypes = { TypeInfoFactory.longTypeInfo };
    ObjectInspector[] inputOIs = { PrimitiveObjectInspectorFactory.writableLongObjectInspector };
    LongWritable[] in = new LongWritable[1];
    in[0] = new LongWritable();
    _agg(fnR, inputTypes, inVals, TypeHandler.LongHandler, in, inputOIs, inSz, numPreceding, numFollowing, outVals);
}
Also used : ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) LongWritable(org.apache.hadoop.io.LongWritable) TypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfo) GenericUDAFSum(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFSum)

Example 2 with GenericUDAFSum

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

the class TestStreamingSum method sumHiveDecimal.

public void sumHiveDecimal(Iterator<HiveDecimal> inVals, int inSz, int numPreceding, int numFollowing, Iterator<HiveDecimal> outVals) throws HiveException {
    GenericUDAFSum fnR = new GenericUDAFSum();
    TypeInfo[] inputTypes = { TypeInfoFactory.decimalTypeInfo };
    ObjectInspector[] inputOIs = { PrimitiveObjectInspectorFactory.writableHiveDecimalObjectInspector };
    HiveDecimalWritable[] in = new HiveDecimalWritable[1];
    in[0] = new HiveDecimalWritable();
    _agg(fnR, inputTypes, inVals, TypeHandler.HiveDecimalHandler, in, inputOIs, inSz, numPreceding, numFollowing, outVals);
}
Also used : ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) HiveDecimalWritable(org.apache.hadoop.hive.serde2.io.HiveDecimalWritable) TypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfo) GenericUDAFSum(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFSum)

Example 3 with GenericUDAFSum

use of org.apache.hadoop.hive.ql.udf.generic.GenericUDAFSum 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);
}
Also used : ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) DoubleWritable(org.apache.hadoop.hive.serde2.io.DoubleWritable) TypeInfo(org.apache.hadoop.hive.serde2.typeinfo.TypeInfo) GenericUDAFSum(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFSum)

Aggregations

GenericUDAFSum (org.apache.hadoop.hive.ql.udf.generic.GenericUDAFSum)3 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)3 TypeInfo (org.apache.hadoop.hive.serde2.typeinfo.TypeInfo)3 DoubleWritable (org.apache.hadoop.hive.serde2.io.DoubleWritable)1 HiveDecimalWritable (org.apache.hadoop.hive.serde2.io.HiveDecimalWritable)1 LongWritable (org.apache.hadoop.io.LongWritable)1