Class SqlBasicAggFunction
SqlAggFunction
.
The class is final, and instances are immutable.
Instances are created only by create(org.apache.calcite.sql.SqlKind, org.apache.calcite.sql.type.SqlReturnTypeInference, org.apache.calcite.sql.type.SqlOperandTypeChecker)
and are
"modified" by "wither" methods such as withDistinct(org.apache.calcite.util.Optionality)
to create a new
instance with one property changed. Since the class is final, you can modify
behavior only by providing strategy objects, not by overriding methods in a
sub-class.
-
Field Summary
Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether this is a window function that allows framing (i.e.boolean
Returns whether this aggregate function allows specifying null treatment (RESPECT NULLS
orIGNORE NULLS
).boolean
Returns whether this aggregate function allows 'SEPARATOR string
' among its arguments.static SqlBasicAggFunction
create
(String name, SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeChecker operandTypeChecker) Creates a SqlBasicAggFunction.static SqlBasicAggFunction
create
(SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeChecker operandTypeChecker) Creates a SqlBasicAggFunction whose name is the same as its kind.deriveType
(SqlValidator validator, SqlValidatorScope scope, SqlCall call) Derives the type of a call to this operator.Returns whether this aggregate function allows theDISTINCT
keyword.Returns the return type inference strategy for this operator, or null if return type inference is implemented by a subclass override.Returns the syntactic type of this operator, never null.boolean
Returns whether this aggregate function is a PERCENTILE function.<T> @Nullable T
Finds an instance of an interface implemented by this object, or returns null if this object does not support that interface.withAllowsFraming
(boolean allowsFraming) SetsallowsFraming()
.withAllowsNullTreatment
(boolean allowsNullTreatment) SetsallowsNullTreatment()
.withAllowsSeparator
(boolean allowsSeparator) SetsallowsSeparator()
.withFunctionType
(SqlFunctionCategory category) withGroupOrder
(Optionality groupOrder) SetsSqlOperator.getName()
.withOver
(boolean over) withPercentile
(boolean percentile) SetsisPercentile()
.withStatic
(SqlStaticAggFunction staticFun) Sets that value to be returned whenunwrap(java.lang.Class<T>)
is applied toSqlStaticAggFunction
.class
.withSyntax
(SqlSyntax syntax) SetsgetSyntax()
.Methods inherited from class org.apache.calcite.sql.SqlAggFunction
allowsFilter, getParameterTypes, getReturnType, getRollup, isAggregator, isQuantifierAllowed, requiresGroupOrder, requiresOrder, requiresOver, validateCall
Methods inherited from class org.apache.calcite.sql.SqlFunction
getFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, unparse, validateQuantifier
Methods inherited from class org.apache.calcite.sql.SqlOperator
acceptCall, acceptCall, adjustType, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveOperandType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getOperandCountRange, getOperandTypeInference, getRightPrec, getSignatureTemplate, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperands
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.calcite.schema.Wrapper
maybeUnwrap, unwrapOrThrow
-
Method Details
-
create
public static SqlBasicAggFunction create(SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeChecker operandTypeChecker) Creates a SqlBasicAggFunction whose name is the same as its kind. -
create
public static SqlBasicAggFunction create(String name, SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeChecker operandTypeChecker) Creates a SqlBasicAggFunction. -
unwrap
Description copied from interface:Wrapper
Finds an instance of an interface implemented by this object, or returns null if this object does not support that interface.- Specified by:
unwrap
in interfaceWrapper
- Overrides:
unwrap
in classSqlAggFunction
-
deriveType
Description copied from class:SqlOperator
Derives the type of a call to this operator.This method is an intrinsic part of the validation process so, unlike
SqlOperator.inferReturnType(org.apache.calcite.sql.SqlOperatorBinding)
, specific operators would not typically override this method.- Overrides:
deriveType
in classSqlFunction
- Parameters:
validator
- Validatorscope
- Scope of validationcall
- Call to this operator- Returns:
- Type of call
-
getDistinctOptionality
Description copied from class:SqlAggFunction
Returns whether this aggregate function allows theDISTINCT
keyword.The default implementation returns
Optionality.OPTIONAL
, which is appropriate for most aggregate functions, includingSUM
andCOUNT
.Some aggregate functions, for example
MIN
, produce the same result with or withoutDISTINCT
, and therefore returnOptionality.IGNORED
to indicate this. For such functions, Calcite will probably removeDISTINCT
while optimizing the query.- Overrides:
getDistinctOptionality
in classSqlAggFunction
-
getReturnTypeInference
Description copied from class:SqlOperator
Returns the return type inference strategy for this operator, or null if return type inference is implemented by a subclass override.- Overrides:
getReturnTypeInference
in classSqlOperator
-
getOperandTypeChecker
- Overrides:
getOperandTypeChecker
in classSqlOperator
-
withName
SetsSqlOperator.getName()
. -
withFunctionType
-
getSyntax
Description copied from class:SqlOperator
Returns the syntactic type of this operator, never null.- Overrides:
getSyntax
in classSqlFunction
-
withSyntax
SetsgetSyntax()
. -
allowsNullTreatment
public boolean allowsNullTreatment()Description copied from class:SqlAggFunction
Returns whether this aggregate function allows specifying null treatment (RESPECT NULLS
orIGNORE NULLS
).- Overrides:
allowsNullTreatment
in classSqlAggFunction
-
withAllowsNullTreatment
SetsallowsNullTreatment()
. -
allowsSeparator
public boolean allowsSeparator()Returns whether this aggregate function allows 'SEPARATOR string
' among its arguments. -
withAllowsSeparator
SetsallowsSeparator()
. -
isPercentile
public boolean isPercentile()Description copied from class:SqlAggFunction
Returns whether this aggregate function is a PERCENTILE function. Such functions require aWITHIN GROUP
clause that has precisely one sort key.NOTE: This API is experimental and subject to change without notice.
- Overrides:
isPercentile
in classSqlAggFunction
-
withPercentile
SetsisPercentile()
. -
allowsFraming
public boolean allowsFraming()Description copied from class:SqlOperator
Returns whether this is a window function that allows framing (i.e. a ROWS or RANGE clause in the window specification).- Overrides:
allowsFraming
in classSqlOperator
-
withAllowsFraming
SetsallowsFraming()
. -
withOver
-
withGroupOrder
-
withStatic
Sets that value to be returned whenunwrap(java.lang.Class<T>)
is applied toSqlStaticAggFunction
.class
.
-