@Internal public class HiveGenericUDAF extends AggregateFunction<Object,org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer> implements HiveFunction
Constructor and Description |
---|
HiveGenericUDAF(HiveFunctionWrapper funcWrapper,
boolean isUDAFBridgeRequired,
HiveShim hiveShim) |
HiveGenericUDAF(HiveFunctionWrapper funcWrapper,
HiveShim hiveShim) |
Modifier and Type | Method and Description |
---|---|
void |
accumulate(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer acc,
Object... inputs) |
org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer |
createAccumulator()
This is invoked without calling open(), so we need to call init() for
getNewAggregationBuffer().
|
org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator |
createEvaluator(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector[] inputInspectors) |
TypeInformation<org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer> |
getAccumulatorType()
Returns the
TypeInformation of the ImperativeAggregateFunction 's accumulator. |
DataType |
getHiveResultType(Object[] constantArguments,
DataType[] argTypes)
Get result type by arguments and argTypes.
|
TypeInformation |
getResultType()
Returns the
TypeInformation of the ImperativeAggregateFunction 's result. |
Object |
getValue(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer accumulator)
Called every time when an aggregation result should be materialized.
|
void |
merge(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer accumulator,
Iterable<org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer> its) |
void |
open(FunctionContext context)
Setup method for user-defined function.
|
void |
setArgumentTypesAndConstants(Object[] constantArguments,
DataType[] argTypes)
Set arguments and argTypes for Function instance.
|
getKind, getTypeInference
close, functionIdentifier, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getRequirements, isDeterministic
public HiveGenericUDAF(HiveFunctionWrapper funcWrapper, HiveShim hiveShim)
public HiveGenericUDAF(HiveFunctionWrapper funcWrapper, boolean isUDAFBridgeRequired, HiveShim hiveShim)
public void open(FunctionContext context) throws Exception
UserDefinedFunction
open
in class UserDefinedFunction
Exception
public org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator createEvaluator(org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector[] inputInspectors) throws org.apache.hadoop.hive.ql.parse.SemanticException
org.apache.hadoop.hive.ql.parse.SemanticException
public org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer createAccumulator()
createAccumulator
in class ImperativeAggregateFunction<Object,org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer>
public void accumulate(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer acc, Object... inputs) throws org.apache.hadoop.hive.ql.metadata.HiveException
org.apache.hadoop.hive.ql.metadata.HiveException
public void merge(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer accumulator, Iterable<org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer> its) throws org.apache.hadoop.hive.ql.metadata.HiveException
org.apache.hadoop.hive.ql.metadata.HiveException
public Object getValue(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer accumulator)
AggregateFunction
getValue
in class AggregateFunction<Object,org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer>
accumulator
- the accumulator which contains the current intermediate resultspublic void setArgumentTypesAndConstants(Object[] constantArguments, DataType[] argTypes)
HiveFunction
setArgumentTypesAndConstants
in interface HiveFunction
constantArguments
- arguments of a function call (only literal arguments are passed,
nulls for non-literal ones)argTypes
- types of argumentspublic DataType getHiveResultType(Object[] constantArguments, DataType[] argTypes)
HiveFunction
We can't use getResultType(Object[], Class[]). The Class[] is the classes of what is defined in eval(), for example, if eval() is "public Integer eval(Double)", the argTypes would be Class[Double]. However, in our wrapper, the signature of eval() is "public Object eval(Object... args)", which means we cannot get any info from the interface.
getHiveResultType
in interface HiveFunction
constantArguments
- arguments of a function call (only literal arguments are passed,
nulls for non-literal ones)argTypes
- types of argumentspublic TypeInformation getResultType()
ImperativeAggregateFunction
TypeInformation
of the ImperativeAggregateFunction
's result.getResultType
in class ImperativeAggregateFunction<Object,org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer>
TypeInformation
of the ImperativeAggregateFunction
's result or
null
if the result type should be automatically inferred.public TypeInformation<org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer> getAccumulatorType()
ImperativeAggregateFunction
TypeInformation
of the ImperativeAggregateFunction
's accumulator.getAccumulatorType
in class ImperativeAggregateFunction<Object,org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer>
TypeInformation
of the ImperativeAggregateFunction
's accumulator
or null
if the accumulator type should be automatically inferred.Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.