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 TypeMethodDescriptionbooleanReturns whether this is a window function that allows framing (i.e.booleanReturns whether this aggregate function allows specifying null treatment (RESPECT NULLSorIGNORE NULLS).booleanReturns whether this aggregate function allows 'SEPARATOR string' among its arguments.static SqlBasicAggFunctioncreate(String name, SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeChecker operandTypeChecker) Creates a SqlBasicAggFunction.static SqlBasicAggFunctioncreate(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 theDISTINCTkeyword.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.booleanReturns whether this aggregate function is a PERCENTILE function.<T> @Nullable TFinds 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, validateCallMethods inherited from class org.apache.calcite.sql.SqlFunction
getFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, unparse, validateQuantifierMethods 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, getSqlCallFactory, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSafeOperator, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperandsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:WrapperFinds an instance of an interface implemented by this object, or returns null if this object does not support that interface.- Specified by:
unwrapin interfaceWrapper- Overrides:
unwrapin classSqlAggFunction
-
deriveType
Description copied from class:SqlOperatorDerives 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:
deriveTypein classSqlFunction- Parameters:
validator- Validatorscope- Scope of validationcall- Call to this operator- Returns:
- Type of call
-
getDistinctOptionality
Description copied from class:SqlAggFunctionReturns whether this aggregate function allows theDISTINCTkeyword.The default implementation returns
Optionality.OPTIONAL, which is appropriate for most aggregate functions, includingSUMandCOUNT.Some aggregate functions, for example
MIN, produce the same result with or withoutDISTINCT, and therefore returnOptionality.IGNOREDto indicate this. For such functions, Calcite will probably removeDISTINCTwhile optimizing the query.- Overrides:
getDistinctOptionalityin classSqlAggFunction
-
getReturnTypeInference
Description copied from class:SqlOperatorReturns the return type inference strategy for this operator, or null if return type inference is implemented by a subclass override.- Overrides:
getReturnTypeInferencein classSqlOperator
-
getOperandTypeChecker
- Overrides:
getOperandTypeCheckerin classSqlOperator
-
withName
SetsSqlOperator.getName(). -
withFunctionType
-
getSyntax
Description copied from class:SqlOperatorReturns the syntactic type of this operator, never null.- Overrides:
getSyntaxin classSqlFunction
-
withSyntax
SetsgetSyntax(). -
allowsNullTreatment
public boolean allowsNullTreatment()Description copied from class:SqlAggFunctionReturns whether this aggregate function allows specifying null treatment (RESPECT NULLSorIGNORE NULLS).- Overrides:
allowsNullTreatmentin 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:SqlAggFunctionReturns whether this aggregate function is a PERCENTILE function. Such functions require aWITHIN GROUPclause that has precisely one sort key.NOTE: This API is experimental and subject to change without notice.
- Overrides:
isPercentilein classSqlAggFunction
-
withPercentile
SetsisPercentile(). -
allowsFraming
public boolean allowsFraming()Description copied from class:SqlOperatorReturns whether this is a window function that allows framing (i.e. a ROWS or RANGE clause in the window specification).- Overrides:
allowsFramingin classSqlOperator
-
withAllowsFraming
SetsallowsFraming(). -
withOver
-
withGroupOrder
-
withStatic
Sets that value to be returned whenunwrap(java.lang.Class<T>)is applied toSqlStaticAggFunction.class.
-