Search in sources :

Example 6 with GenericUDAFResolver

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

the class Registry method getGenericUDAFEvaluator.

/**
 * Get the GenericUDAF evaluator for the name and argumentClasses.
 *
 * @param name         the name of the UDAF
 * @param argumentOIs
 * @param isDistinct
 * @param isAllColumns
 * @return The UDAF evaluator
 */
@SuppressWarnings("deprecation")
public GenericUDAFEvaluator getGenericUDAFEvaluator(String name, List<ObjectInspector> argumentOIs, boolean isWindowing, boolean isDistinct, boolean isAllColumns, boolean respectNulls) throws SemanticException {
    GenericUDAFResolver udafResolver = getGenericUDAFResolver(name);
    if (udafResolver == null) {
        return null;
    }
    GenericUDAFEvaluator udafEvaluator;
    ObjectInspector[] args = new ObjectInspector[argumentOIs.size()];
    // generics + arrays.
    for (int ii = 0; ii < argumentOIs.size(); ++ii) {
        args[ii] = argumentOIs.get(ii);
    }
    GenericUDAFParameterInfo paramInfo = new SimpleGenericUDAFParameterInfo(args, isWindowing, isDistinct, isAllColumns, respectNulls);
    if (udafResolver instanceof GenericUDAFResolver2) {
        udafEvaluator = ((GenericUDAFResolver2) udafResolver).getEvaluator(paramInfo);
    } else {
        udafEvaluator = udafResolver.getEvaluator(paramInfo.getParameters());
    }
    return udafEvaluator;
}
Also used : SimpleGenericUDAFParameterInfo(org.apache.hadoop.hive.ql.udf.generic.SimpleGenericUDAFParameterInfo) GenericUDAFResolver2(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFResolver2) ObjectInspector(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector) GenericUDAFEvaluator(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator) GenericUDAFParameterInfo(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFParameterInfo) SimpleGenericUDAFParameterInfo(org.apache.hadoop.hive.ql.udf.generic.SimpleGenericUDAFParameterInfo) GenericUDAFResolver(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFResolver)

Aggregations

GenericUDAFResolver (org.apache.hadoop.hive.ql.udf.generic.GenericUDAFResolver)6 GenericUDAFCount (org.apache.hadoop.hive.ql.udf.generic.GenericUDAFCount)2 GenericUDAFEvaluator (org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator)2 GenericUDAFParameterInfo (org.apache.hadoop.hive.ql.udf.generic.GenericUDAFParameterInfo)2 GenericUDAFResolver2 (org.apache.hadoop.hive.ql.udf.generic.GenericUDAFResolver2)2 SimpleGenericUDAFParameterInfo (org.apache.hadoop.hive.ql.udf.generic.SimpleGenericUDAFParameterInfo)2 ObjectInspector (org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector)2 CalciteSubquerySemanticException (org.apache.hadoop.hive.ql.optimizer.calcite.CalciteSubquerySemanticException)1 PrimitiveTypeInfo (org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo)1 TypeInfo (org.apache.hadoop.hive.serde2.typeinfo.TypeInfo)1