org.apache.hadoop.hive.ql.udf.generic
Class GenericUDAFAverage
java.lang.Object
org.apache.hadoop.hive.ql.udf.generic.AbstractGenericUDAFResolver
org.apache.hadoop.hive.ql.udf.generic.GenericUDAFAverage
- All Implemented Interfaces:
- GenericUDAFResolver, GenericUDAFResolver2
public class GenericUDAFAverage
- extends AbstractGenericUDAFResolver
GenericUDAFAverage.
GenericUDAFAverage
public GenericUDAFAverage()
getEvaluator
public GenericUDAFEvaluator getEvaluator(TypeInfo[] parameters)
throws SemanticException
- Description copied from interface:
GenericUDAFResolver
- Get the evaluator for the parameter types.
The reason that this function returns an object instead of a class is
because it is possible that the object needs some configuration (that can
be serialized). In that case the class of the object has to implement the
Serializable interface. At execution time, we will deserialize the object
from the plan and use it to evaluate the aggregations.
If the class of the object does not implement Serializable, then we will
create a new instance of the class at execution time.
- Specified by:
getEvaluator
in interface GenericUDAFResolver
- Overrides:
getEvaluator
in class AbstractGenericUDAFResolver
- Parameters:
parameters
- The types of the parameters. We need the type information to know
which evaluator class to use.
- Throws:
SemanticException
deriveSumFieldTypeInfo
public static DecimalTypeInfo deriveSumFieldTypeInfo(int precision,
int scale)
- The intermediate sum field has 10 more integer digits with the same scale.
This is exposed as static so that the vectorized AVG operator use the same logic
- Parameters:
precision
- scale
-
- Returns:
Copyright © 2014 The Apache Software Foundation. All rights reserved.