org.apache.hadoop.hive.ql.udf.generic
Class GenericUDAFAverage.AbstractGenericUDAFAverageEvaluator<TYPE>
java.lang.Object
org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator
org.apache.hadoop.hive.ql.udf.generic.GenericUDAFAverage.AbstractGenericUDAFAverageEvaluator<TYPE>
- All Implemented Interfaces:
- Closeable
- Direct Known Subclasses:
- GenericUDAFAverage.GenericUDAFAverageEvaluatorDecimal, GenericUDAFAverage.GenericUDAFAverageEvaluatorDouble
- Enclosing class:
- GenericUDAFAverage
public abstract static class GenericUDAFAverage.AbstractGenericUDAFAverageEvaluator<TYPE>
- extends GenericUDAFEvaluator
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
partialResult
protected transient Object[] partialResult
GenericUDAFAverage.AbstractGenericUDAFAverageEvaluator
public GenericUDAFAverage.AbstractGenericUDAFAverageEvaluator()
getSumFieldJavaObjectInspector
protected abstract ObjectInspector getSumFieldJavaObjectInspector()
getSumFieldWritableObjectInspector
protected abstract ObjectInspector getSumFieldWritableObjectInspector()
doIterate
protected abstract void doIterate(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFAverage.AverageAggregationBuffer<TYPE> aggregation,
PrimitiveObjectInspector inputOI,
Object parameter)
doMerge
protected abstract void doMerge(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFAverage.AverageAggregationBuffer<TYPE> aggregation,
Long partialCount,
ObjectInspector sumFieldOI,
Object partialSum)
doTerminatePartial
protected abstract void doTerminatePartial(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFAverage.AverageAggregationBuffer<TYPE> aggregation)
doTerminate
protected abstract Object doTerminate(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFAverage.AverageAggregationBuffer<TYPE> aggregation)
doReset
protected abstract void doReset(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFAverage.AverageAggregationBuffer<TYPE> aggregation)
throws HiveException
- Throws:
HiveException
init
public ObjectInspector init(GenericUDAFEvaluator.Mode m,
ObjectInspector[] parameters)
throws HiveException
- Description copied from class:
GenericUDAFEvaluator
- Initialize the evaluator.
- Overrides:
init
in class GenericUDAFEvaluator
- Parameters:
m
- The mode of aggregation.parameters
- The ObjectInspector for the parameters: In PARTIAL1 and COMPLETE
mode, the parameters are original data; In PARTIAL2 and FINAL
mode, the parameters are just partial aggregations (in that case,
the array will always have a single element).
- Returns:
- The ObjectInspector for the return value. In PARTIAL1 and PARTIAL2
mode, the ObjectInspector for the return value of
terminatePartial() call; In FINAL and COMPLETE mode, the
ObjectInspector for the return value of terminate() call.
NOTE: We need ObjectInspector[] (in addition to the TypeInfo[] in
GenericUDAFResolver) for 2 reasons: 1. ObjectInspector contains
more information than TypeInfo; and GenericUDAFEvaluator.init at
execution time. 2. We call GenericUDAFResolver.getEvaluator at
compilation time,
- Throws:
HiveException
reset
public void reset(GenericUDAFEvaluator.AggregationBuffer aggregation)
throws HiveException
- Description copied from class:
GenericUDAFEvaluator
- Reset the aggregation. This is useful if we want to reuse the same
aggregation.
- Specified by:
reset
in class GenericUDAFEvaluator
- Throws:
HiveException
iterate
public void iterate(GenericUDAFEvaluator.AggregationBuffer aggregation,
Object[] parameters)
throws HiveException
- Description copied from class:
GenericUDAFEvaluator
- Iterate through original data.
- Specified by:
iterate
in class GenericUDAFEvaluator
parameters
- The objects of parameters.
- Throws:
HiveException
terminatePartial
public Object terminatePartial(GenericUDAFEvaluator.AggregationBuffer aggregation)
throws HiveException
- Description copied from class:
GenericUDAFEvaluator
- Get partial aggregation result.
- Specified by:
terminatePartial
in class GenericUDAFEvaluator
- Returns:
- partial aggregation result.
- Throws:
HiveException
merge
public void merge(GenericUDAFEvaluator.AggregationBuffer aggregation,
Object partial)
throws HiveException
- Description copied from class:
GenericUDAFEvaluator
- Merge with partial aggregation result. NOTE: null might be passed in case
there is no input data.
- Specified by:
merge
in class GenericUDAFEvaluator
partial
- The partial aggregation result.
- Throws:
HiveException
terminate
public Object terminate(GenericUDAFEvaluator.AggregationBuffer aggregation)
throws HiveException
- Description copied from class:
GenericUDAFEvaluator
- Get final aggregation result.
- Specified by:
terminate
in class GenericUDAFEvaluator
- Returns:
- final aggregation result.
- Throws:
HiveException
Copyright © 2012 The Apache Software Foundation