public final class SqlBasicAggFunction extends SqlAggFunction
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.
kind, MDX_PRECEDENCE, NL| Modifier and Type | Method and Description |
|---|---|
boolean |
allowsNullTreatment()
Returns whether this aggregate function allows specifying null treatment
(
RESPECT NULLS or IGNORE NULLS). |
boolean |
allowsSeparator()
Returns whether this aggregate function allows '
SEPARATOR string'
among its arguments. |
static SqlBasicAggFunction |
create(SqlKind kind,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeChecker operandTypeChecker)
Creates a SqlBasicAggFunction whose name is the same as its kind.
|
static SqlBasicAggFunction |
create(String name,
SqlKind kind,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeChecker operandTypeChecker)
Creates a SqlBasicAggFunction.
|
RelDataType |
deriveType(SqlValidator validator,
SqlValidatorScope scope,
SqlCall call)
Derives the type of a call to this operator.
|
Optionality |
getDistinctOptionality()
Returns whether this aggregate function allows the
DISTINCT
keyword. |
SqlOperandTypeChecker |
getOperandTypeChecker() |
SqlReturnTypeInference |
getReturnTypeInference()
Returns the return type inference strategy for this operator, or null if
return type inference is implemented by a subclass override.
|
SqlSyntax |
getSyntax()
Returns the syntactic type of this operator, never null.
|
boolean |
isPercentile()
Returns whether this aggregate function is a PERCENTILE function.
|
SqlBasicAggFunction |
withAllowsNullTreatment(boolean allowsNullTreatment)
Sets
allowsNullTreatment(). |
SqlBasicAggFunction |
withAllowsSeparator(boolean allowsSeparator)
Sets
allowsSeparator(). |
SqlBasicAggFunction |
withFunctionType(SqlFunctionCategory category)
|
SqlBasicAggFunction |
withGroupOrder(Optionality groupOrder)
|
SqlBasicAggFunction |
withPercentile(boolean percentile)
Sets
isPercentile(). |
SqlBasicAggFunction |
withSyntax(SqlSyntax syntax)
Sets
getSyntax(). |
allowsFilter, getParameterTypes, getReturnType, getRollup, isAggregator, isQuantifierAllowed, requiresGroupOrder, requiresOrder, requiresOver, unwrap, validateCallgetFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, unparse, validateQuantifieracceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, 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, validRexOperandsclone, finalize, getClass, notify, notifyAll, wait, wait, waitmaybeUnwrap, unwrapOrThrowpublic static SqlBasicAggFunction create(SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeChecker operandTypeChecker)
public static SqlBasicAggFunction create(String name, SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeChecker operandTypeChecker)
public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call)
SqlOperatorThis 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.
deriveType in class SqlFunctionvalidator - Validatorscope - Scope of validationcall - Call to this operatorpublic Optionality getDistinctOptionality()
SqlAggFunctionDISTINCT
keyword.
The default implementation returns Optionality.OPTIONAL,
which is appropriate for most aggregate functions, including SUM
and COUNT.
Some aggregate functions, for example MIN, produce the same
result with or without DISTINCT, and therefore return
Optionality.IGNORED to indicate this. For such functions,
Calcite will probably remove DISTINCT while optimizing the query.
getDistinctOptionality in class SqlAggFunctionpublic SqlReturnTypeInference getReturnTypeInference()
SqlOperatorgetReturnTypeInference in class SqlOperatorpublic SqlOperandTypeChecker getOperandTypeChecker()
getOperandTypeChecker in class SqlOperatorpublic SqlBasicAggFunction withFunctionType(SqlFunctionCategory category)
public SqlSyntax getSyntax()
SqlOperatorgetSyntax in class SqlFunctionpublic SqlBasicAggFunction withSyntax(SqlSyntax syntax)
getSyntax().public boolean allowsNullTreatment()
SqlAggFunctionRESPECT NULLS or IGNORE NULLS).allowsNullTreatment in class SqlAggFunctionpublic SqlBasicAggFunction withAllowsNullTreatment(boolean allowsNullTreatment)
allowsNullTreatment().public boolean allowsSeparator()
SEPARATOR string'
among its arguments.public SqlBasicAggFunction withAllowsSeparator(boolean allowsSeparator)
allowsSeparator().public boolean isPercentile()
SqlAggFunctionWITHIN GROUP clause that has precisely
one sort key.
NOTE: This API is experimental and subject to change without notice.
isPercentile in class SqlAggFunctionpublic SqlBasicAggFunction withPercentile(boolean percentile)
isPercentile().public SqlBasicAggFunction withGroupOrder(Optionality groupOrder)
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.