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
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:
SELECT STREAM HOP_START(rowtime, INTERVAL '1' HOUR), HOP_END(rowtime, INTERVAL '1' HOUR), MIN(unitPrice) FROM Orders GROUP BY HOP(rowtime, INTERVAL '1' HOUR), productId
-
Field Summary
Modifier and TypeFieldDescriptionfinal @Nullable SqlGroupedWindowFunction
The grouped function, if this an auxiliary function; null otherwise.Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL
-
Constructor Summary
ConstructorDescriptionSqlGroupedWindowFunction
(String name, SqlKind kind, @Nullable SqlGroupedWindowFunction groupFunction, @Nullable SqlOperandTypeChecker operandTypeChecker) Deprecated.SqlGroupedWindowFunction
(String name, SqlKind kind, @Nullable SqlGroupedWindowFunction groupFunction, SqlReturnTypeInference returnTypeInference, @Nullable SqlOperandTypeInference operandTypeInference, @Nullable SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory category) Creates a SqlGroupedWindowFunction.SqlGroupedWindowFunction
(SqlKind kind, @Nullable SqlGroupedWindowFunction groupFunction, @Nullable SqlOperandTypeChecker operandTypeChecker) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionCreates an auxiliary function from this grouped window function.Creates an auxiliary function from this grouped window function.Returns a list of this grouped window function's auxiliary functions.Returns whether a call to this operator is monotonic.boolean
isGroup()
Returns whether this is a group function.boolean
Returns whether this is an group auxiliary function.Methods inherited from class org.apache.calcite.sql.SqlFunction
deriveType, getFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, getSyntax, isQuantifierAllowed, unparse, validateCall, validateQuantifier
Methods 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, SqlKind kind, @Nullable SqlGroupedWindowFunction groupFunction, SqlReturnTypeInference returnTypeInference, @Nullable SqlOperandTypeInference operandTypeInference, @Nullable SqlOperandTypeChecker operandTypeChecker, 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
@Deprecated public SqlGroupedWindowFunction(String name, SqlKind kind, @Nullable SqlGroupedWindowFunction groupFunction, @Nullable SqlOperandTypeChecker operandTypeChecker) Deprecated. -
SqlGroupedWindowFunction
@Deprecated public SqlGroupedWindowFunction(SqlKind kind, @Nullable SqlGroupedWindowFunction groupFunction, @Nullable SqlOperandTypeChecker operandTypeChecker) Deprecated.
-
-
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()Description copied from class:SqlOperator
Returns whether this is a group function.Group functions can only appear in the GROUP BY clause.
Examples are
HOP
,TUMBLE
,SESSION
.Group functions have auxiliary functions, e.g.
HOP_START
, but these are not group functions.- Overrides:
isGroup
in classSqlOperator
-
isGroupAuxiliary
public boolean isGroupAuxiliary()Description copied from class:SqlOperator
Returns whether this is an group auxiliary function.Examples are
HOP_START
andHOP_END
(both auxiliary toHOP
).- Overrides:
isGroupAuxiliary
in classSqlOperator
- See Also:
-
getMonotonicity
Description copied from class:SqlOperator
Returns whether a call to this operator is monotonic.Default implementation returns
SqlMonotonicity.NOT_MONOTONIC
.- Overrides:
getMonotonicity
in classSqlOperator
- Parameters:
call
- Call to this operator with particular arguments and information about the monotonicity of the arguments
-