|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator
org.apache.hadoop.hive.ql.udf.generic.GenericUDAFVariance.GenericUDAFVarianceEvaluator
public static class GenericUDAFVariance.GenericUDAFVarianceEvaluator
Evaluate the variance using the following modification of the formula from The Art of Computer Programming, vol. 2, p. 232: variance = variance1 + variance2 + n*alpha^2 + m*betha^2 where: - variance is sum[x-avg^2] (this is actually n times the variance) and is updated at every step. - n is the count of elements in chunk1 - m is the count of elements in chunk2 - alpha = avg-a - betha = avg-b - avg is the the average of all elements from both chunks - a is the average of elements in chunk1 - b is the average of elements in chunk2
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator |
---|
GenericUDAFEvaluator.AggregationBuffer, GenericUDAFEvaluator.Mode |
Constructor Summary | |
---|---|
GenericUDAFVariance.GenericUDAFVarianceEvaluator()
|
Method Summary | |
---|---|
GenericUDAFEvaluator.AggregationBuffer |
getNewAggregationBuffer()
Get a new aggregation object. |
ObjectInspector |
init(GenericUDAFEvaluator.Mode m,
ObjectInspector[] parameters)
Initialize the evaluator. |
void |
iterate(GenericUDAFEvaluator.AggregationBuffer agg,
Object[] parameters)
Iterate through original data. |
void |
merge(GenericUDAFEvaluator.AggregationBuffer agg,
Object partial)
Merge with partial aggregation result. |
void |
reset(GenericUDAFEvaluator.AggregationBuffer agg)
Reset the aggregation. |
Object |
terminate(GenericUDAFEvaluator.AggregationBuffer agg)
Get final aggregation result. |
Object |
terminatePartial(GenericUDAFEvaluator.AggregationBuffer agg)
Get partial aggregation result. |
Methods inherited from class org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator |
---|
aggregate, evaluate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericUDAFVariance.GenericUDAFVarianceEvaluator()
Method Detail |
---|
public ObjectInspector init(GenericUDAFEvaluator.Mode m, ObjectInspector[] parameters) throws HiveException
GenericUDAFEvaluator
init
in class GenericUDAFEvaluator
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).
HiveException
public GenericUDAFEvaluator.AggregationBuffer getNewAggregationBuffer() throws HiveException
GenericUDAFEvaluator
getNewAggregationBuffer
in class GenericUDAFEvaluator
HiveException
public void reset(GenericUDAFEvaluator.AggregationBuffer agg) throws HiveException
GenericUDAFEvaluator
reset
in class GenericUDAFEvaluator
HiveException
public void iterate(GenericUDAFEvaluator.AggregationBuffer agg, Object[] parameters) throws HiveException
GenericUDAFEvaluator
iterate
in class GenericUDAFEvaluator
parameters
- The objects of parameters.
HiveException
public Object terminatePartial(GenericUDAFEvaluator.AggregationBuffer agg) throws HiveException
GenericUDAFEvaluator
terminatePartial
in class GenericUDAFEvaluator
HiveException
public void merge(GenericUDAFEvaluator.AggregationBuffer agg, Object partial) throws HiveException
GenericUDAFEvaluator
merge
in class GenericUDAFEvaluator
partial
- The partial aggregation result.
HiveException
public Object terminate(GenericUDAFEvaluator.AggregationBuffer agg) throws HiveException
GenericUDAFEvaluator
terminate
in class GenericUDAFEvaluator
HiveException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |