Package org.apache.calcite.sql
Class SqlGroupedWindowFunction
java.lang.Object
org.apache.calcite.sql.SqlOperator
org.apache.calcite.sql.SqlFunction
org.apache.calcite.sql.SqlGroupedWindowFunction
public class SqlGroupedWindowFunction
extends org.apache.calcite.sql.SqlFunction
SQL function that computes keys by which rows can be partitioned and aggregated.
Grouped window functions always occur in the GROUP BY clause. They often have auxiliary
functions that access information about the group. For example, HOP is a group function,
and its auxiliary functions are HOP_START and HOP_END. Here they are used in a
streaming query:
Note: we copied the implementation from Calcite's SqlGroupedWindowFunction because of CALCITE-4563, Calcite currently
doesn't allow to set the SqlReturnTypeInference of auxiliary SqlGroupedWindowFunction.
The motivation is using TIMESTAMP type for the window start and window end no matter the time attribute column is TIMESTAMP or TIMESTAMP_LTZ.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal SqlGroupedWindowFunctionThe grouped function, if this an auxiliary function; null otherwise.Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL -
Constructor Summary
ConstructorsConstructorDescriptionSqlGroupedWindowFunction(String name, org.apache.calcite.sql.SqlKind kind, SqlGroupedWindowFunction groupFunction, org.apache.calcite.sql.type.SqlOperandTypeChecker operandTypeChecker) Creates a SqlGroupedWindowFunction.SqlGroupedWindowFunction(String name, org.apache.calcite.sql.SqlKind kind, SqlGroupedWindowFunction groupFunction, org.apache.calcite.sql.type.SqlReturnTypeInference returnTypeInference, org.apache.calcite.sql.type.SqlOperandTypeInference operandTypeInference, org.apache.calcite.sql.type.SqlOperandTypeChecker operandTypeChecker, org.apache.calcite.sql.SqlFunctionCategory category) Creates a SqlGroupedWindowFunction. -
Method Summary
Modifier and TypeMethodDescriptionCreates an auxiliary function from this grouped window function.auxiliary(org.apache.calcite.sql.SqlKind kind) Creates an auxiliary function from this grouped window function.Returns a list of this grouped window function's auxiliary functions.org.apache.calcite.sql.validate.SqlMonotonicitygetMonotonicity(org.apache.calcite.sql.SqlOperatorBinding call) booleanisGroup()booleanMethods inherited from class org.apache.calcite.sql.SqlFunction
deriveType, getFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, getSyntax, isQuantifierAllowed, unparse, validateCall, validateQuantifierMethods inherited from class org.apache.calcite.sql.SqlOperator
acceptCall, acceptCall, adjustType, allowsFraming, argumentMustBeScalar, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveOperandType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isName, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperands
-
Field Details
-
groupFunction
The grouped function, if this an auxiliary function; null otherwise.
-
-
Constructor Details
-
SqlGroupedWindowFunction
public SqlGroupedWindowFunction(String name, org.apache.calcite.sql.SqlKind kind, SqlGroupedWindowFunction groupFunction, org.apache.calcite.sql.type.SqlReturnTypeInference returnTypeInference, org.apache.calcite.sql.type.SqlOperandTypeInference operandTypeInference, org.apache.calcite.sql.type.SqlOperandTypeChecker operandTypeChecker, org.apache.calcite.sql.SqlFunctionCategory category) Creates a SqlGroupedWindowFunction.- Parameters:
name- Function namekind- KindgroupFunction- Group function, if this is an auxiliary; null, if this is a group functionreturnTypeInference- Strategy to use for return type inferenceoperandTypeInference- Strategy to use for parameter type inferenceoperandTypeChecker- Strategy to use for parameter type checkingcategory- Categorization for function
-
SqlGroupedWindowFunction
public SqlGroupedWindowFunction(String name, org.apache.calcite.sql.SqlKind kind, SqlGroupedWindowFunction groupFunction, org.apache.calcite.sql.type.SqlOperandTypeChecker operandTypeChecker) Creates a SqlGroupedWindowFunction.- Parameters:
name- Function namekind- KindgroupFunction- Group function, if this is an auxiliary; null, if this is a group function
-
-
Method Details
-
auxiliary
Creates an auxiliary function from this grouped window function.- Parameters:
kind- Kind; also determines function name
-
auxiliary
Creates an auxiliary function from this grouped window function.- Parameters:
name- Function namekind- Kind
-
getAuxiliaryFunctions
Returns a list of this grouped window function's auxiliary functions. -
isGroup
public boolean isGroup()- Overrides:
isGroupin classorg.apache.calcite.sql.SqlOperator
-
isGroupAuxiliary
public boolean isGroupAuxiliary()- Overrides:
isGroupAuxiliaryin classorg.apache.calcite.sql.SqlOperator
-
getMonotonicity
public org.apache.calcite.sql.validate.SqlMonotonicity getMonotonicity(org.apache.calcite.sql.SqlOperatorBinding call) - Overrides:
getMonotonicityin classorg.apache.calcite.sql.SqlOperator
-