public abstract class SqlAggFunction extends SqlFunction implements Context
| Modifier and Type | Field and Description |
|---|---|
private boolean |
requiresOrder |
private boolean |
requiresOver |
kind, MDX_PRECEDENCE, NL| Modifier | Constructor and Description |
|---|---|
protected |
SqlAggFunction(String name,
SqlIdentifier sqlIdentifier,
SqlKind kind,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeInference operandTypeInference,
SqlOperandTypeChecker operandTypeChecker,
SqlFunctionCategory funcType)
Deprecated.
|
protected |
SqlAggFunction(String name,
SqlIdentifier sqlIdentifier,
SqlKind kind,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeInference operandTypeInference,
SqlOperandTypeChecker operandTypeChecker,
SqlFunctionCategory funcType,
boolean requiresOrder,
boolean requiresOver)
Creates a built-in or user-defined SqlAggFunction or window function.
|
protected |
SqlAggFunction(String name,
SqlKind kind,
SqlReturnTypeInference returnTypeInference,
SqlOperandTypeInference operandTypeInference,
SqlOperandTypeChecker operandTypeChecker,
SqlFunctionCategory funcType)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowsFilter()
Whether this aggregate function allows a
FILTER (WHERE ...)
clause. |
List<RelDataType> |
getParameterTypes(RelDataTypeFactory typeFactory)
Deprecated.
|
RelDataType |
getReturnType(RelDataTypeFactory typeFactory)
Deprecated.
|
boolean |
isAggregator()
Returns whether this operator is an aggregate function.
|
boolean |
isQuantifierAllowed()
Returns whether this function allows a
DISTINCT or
ALL quantifier. |
boolean |
requiresOrder()
Returns whether this is a window function that requires ordering.
|
boolean |
requiresOver()
Returns whether this is a window function that requires an OVER clause.
|
<T> T |
unwrap(Class<T> clazz)
Finds an instance of an interface implemented by this object,
or returns null if this object does not support that interface.
|
void |
validateCall(SqlCall call,
SqlValidator validator,
SqlValidatorScope scope,
SqlValidatorScope operandScope)
Validates a call to this operator.
|
deriveType, getFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, getSyntax, unparse, validateQuantifieracceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, hashCode, inferReturnType, inferReturnType, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, leftPrec, needsSpace, preValidateCall, requiresDecimalExpansion, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperandsprivate final boolean requiresOrder
private final boolean requiresOver
@Deprecated protected SqlAggFunction(String name, SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory funcType)
@Deprecated protected SqlAggFunction(String name, SqlIdentifier sqlIdentifier, SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory funcType)
protected SqlAggFunction(String name, SqlIdentifier sqlIdentifier, SqlKind kind, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory funcType, boolean requiresOrder, boolean requiresOver)
A user-defined function will have a value for sqlIdentifier; for
a built-in function it will be null.
public <T> T unwrap(Class<T> clazz)
Wrapperpublic boolean isAggregator()
SqlOperatorPer SQL:2011, there are aggregate functions and window functions. Every aggregate function (e.g. SUM) is also a window function. There are window functions that are not aggregate functions, e.g. RANK, NTILE, LEAD, FIRST_VALUE.
Collectively, aggregate and window functions are called analytic functions. Despite its name, this method returns true for every analytic function.
isAggregator in class SqlOperatorSqlOperator.requiresOrder()public boolean isQuantifierAllowed()
SqlFunctionDISTINCT or
ALL quantifier. The default is false; some aggregate
functions return true.isQuantifierAllowed in class SqlFunctionpublic void validateCall(SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope)
SqlOperatorThis method should not perform type-derivation or perform validation
related related to types. That is done later, by
SqlOperator.deriveType(SqlValidator, SqlValidatorScope, SqlCall). This method
should focus on structural validation.
A typical implementation of this method first validates the operands, then performs some operator-specific logic. The default implementation just validates the operands.
This method is the default implementation of SqlCall.validate(org.apache.calcite.sql.validate.SqlValidator, org.apache.calcite.sql.validate.SqlValidatorScope);
but note that some sub-classes of SqlCall never call this method.
validateCall in class SqlFunctioncall - the call to this operatorvalidator - the active validatorscope - validator scopeoperandScope - validator scope in which to validate operands to this
call; usually equal to scope, but not always because
some operators introduce new scopesSqlNode.validateExpr(SqlValidator, SqlValidatorScope),
SqlOperator.deriveType(SqlValidator, SqlValidatorScope, SqlCall)public final boolean requiresOrder()
SqlOperatorPer SQL:2011, 2, 6.10: "If <ntile function>, <lead or lag function>, RANK or DENSE_RANK is specified, then the window ordering clause shall be present."
requiresOrder in class SqlOperatorSqlOperator.isAggregator()public final boolean requiresOver()
SqlOperatorFor example, returns true for RANK, DENSE_RANK and
other ranking functions; returns false for SUM, COUNT,
MIN, MAX, AVG (they can be used as non-window
aggregate functions).
If requiresOver returns true, then SqlOperator.isAggregator() must
also return true.
requiresOver in class SqlOperatorSqlOperator.allowsFraming(),
SqlOperator.requiresOrder()@Deprecated public List<RelDataType> getParameterTypes(RelDataTypeFactory typeFactory)
@Deprecated public RelDataType getReturnType(RelDataTypeFactory typeFactory)
public boolean allowsFilter()
FILTER (WHERE ...)
clause.Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.