@Internal public abstract class HiveDeclarativeAggregateFunction extends DeclarativeAggregateFunction
Compared to DeclarativeAggregateFunction
, this API provides extra setArguments(org.apache.flink.table.types.inference.CallContext)
method that is used to set input arguments information before call other methods.
We need this API because the aggBuffer and result type of some hive aggregate functions such as
sum is decided by the input type, this can be achieved by implements setArguments(org.apache.flink.table.types.inference.CallContext)
method
correctly.
Moreover, if the hive aggregate function implements this API, planner will use the hash aggregate strategy instead of sort aggregation that performance will be better.
Modifier and Type | Field and Description |
---|---|
protected static int |
MAX_SCALE |
Constructor and Description |
---|
HiveDeclarativeAggregateFunction() |
Modifier and Type | Method and Description |
---|---|
protected UnresolvedCallExpression |
adjustedPlus(DataType dataType,
Expression arg1,
Expression arg2) |
protected void |
checkArgumentNum(List<DataType> arguments) |
protected void |
checkMinMaxArgumentType(LogicalType logicalType,
String functionName) |
FunctionKind |
getKind()
Returns the kind of function this definition describes.
|
TypeInference |
getTypeInference(DataTypeFactory factory)
This method is used to infer result type when generate
AggregateCall of calcite. |
abstract void |
setArguments(CallContext callContext)
Set input arguments for the function if need some inputs to infer the aggBuffer type and
result type.
|
accumulateExpressions, aggBufferAttributes, getAggBufferTypes, getResultType, getValueExpression, initialValuesExpressions, mergeExpressions, mergeOperand, mergeOperands, operand, operandCount, operands, retractExpressions
close, functionIdentifier, open, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getRequirements, isDeterministic, supportsConstantFolding
protected static final int MAX_SCALE
public abstract void setArguments(CallContext callContext)
public TypeInference getTypeInference(DataTypeFactory factory)
AggregateCall
of calcite.getTypeInference
in interface FunctionDefinition
getTypeInference
in class DeclarativeAggregateFunction
protected void checkMinMaxArgumentType(LogicalType logicalType, String functionName)
protected UnresolvedCallExpression adjustedPlus(DataType dataType, Expression arg1, Expression arg2)
public FunctionKind getKind()
FunctionDefinition
getKind
in interface FunctionDefinition
getKind
in class DeclarativeAggregateFunction
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.