@Internal public class HiveGenericUDAF extends org.apache.flink.table.functions.AggregateFunction<Object,org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer> implements HiveFunction
AggregateFunction implementation that calls Hive's UDAF or GenericUDAFEvaluator.| 构造器和说明 |
|---|
HiveGenericUDAF(HiveFunctionWrapper funcWrapper,
boolean isUDAFBridgeRequired,
HiveShim hiveShim) |
HiveGenericUDAF(HiveFunctionWrapper funcWrapper,
HiveShim hiveShim) |
| 限定符和类型 | 方法和说明 |
|---|---|
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() in Blink, so we need to call init() for getNewAggregationBuffer().
|
org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer> |
getAccumulatorType() |
org.apache.flink.table.types.DataType |
getHiveResultType(Object[] constantArguments,
org.apache.flink.table.types.DataType[] argTypes)
Get result type by arguments and argTypes.
|
org.apache.flink.api.common.typeinfo.TypeInformation |
getResultType() |
Object |
getValue(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer accumulator) |
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(org.apache.flink.table.functions.FunctionContext context) |
void |
setArgumentTypesAndConstants(Object[] constantArguments,
org.apache.flink.table.types.DataType[] argTypes)
Set arguments and argTypes for Function instance.
|
public HiveGenericUDAF(HiveFunctionWrapper funcWrapper, HiveShim hiveShim)
public HiveGenericUDAF(HiveFunctionWrapper funcWrapper, boolean isUDAFBridgeRequired, HiveShim hiveShim)
public void open(org.apache.flink.table.functions.FunctionContext context)
throws Exception
open 在类中 org.apache.flink.table.functions.UserDefinedFunctionExceptionpublic org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer createAccumulator()
createAccumulator 在类中 org.apache.flink.table.functions.UserDefinedAggregateFunction<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.HiveExceptionpublic 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.HiveExceptionpublic Object getValue(org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer accumulator)
getValue 在类中 org.apache.flink.table.functions.AggregateFunction<Object,org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer>public void setArgumentTypesAndConstants(Object[] constantArguments, org.apache.flink.table.types.DataType[] argTypes)
HiveFunctionsetArgumentTypesAndConstants 在接口中 HiveFunctionconstantArguments - arguments of a function call (only literal arguments
are passed, nulls for non-literal ones)argTypes - types of argumentspublic org.apache.flink.table.types.DataType getHiveResultType(Object[] constantArguments, org.apache.flink.table.types.DataType[] argTypes)
HiveFunctionWe 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 在接口中 HiveFunctionconstantArguments - arguments of a function call (only literal arguments
are passed, nulls for non-literal ones)argTypes - types of argumentspublic org.apache.flink.api.common.typeinfo.TypeInformation getResultType()
getResultType 在类中 org.apache.flink.table.functions.UserDefinedAggregateFunction<Object,org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer>public org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer> getAccumulatorType()
getAccumulatorType 在类中 org.apache.flink.table.functions.UserDefinedAggregateFunction<Object,org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer>Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.