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 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 areHOP_START
andHOP_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
Fields Modifier and Type Field Description SqlGroupedWindowFunction
groupFunction
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
Constructors Constructor Description SqlGroupedWindowFunction(java.lang.String name, SqlKind kind, SqlGroupedWindowFunction groupFunction, SqlOperandTypeChecker operandTypeChecker)
Deprecated.SqlGroupedWindowFunction(java.lang.String name, SqlKind kind, SqlGroupedWindowFunction groupFunction, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, SqlOperandTypeChecker operandTypeChecker, SqlFunctionCategory category)
Creates a SqlGroupedWindowFunction.SqlGroupedWindowFunction(SqlKind kind, SqlGroupedWindowFunction groupFunction, SqlOperandTypeChecker operandTypeChecker)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SqlGroupedWindowFunction
auxiliary(java.lang.String name, SqlKind kind)
Creates an auxiliary function from this grouped window function.SqlGroupedWindowFunction
auxiliary(SqlKind kind)
Creates an auxiliary function from this grouped window function.java.util.List<SqlGroupedWindowFunction>
getAuxiliaryFunctions()
Returns a list of this grouped window function's auxiliary functions.SqlMonotonicity
getMonotonicity(SqlOperatorBinding call)
Returns whether a call to this operator is monotonic.boolean
isGroup()
Returns whether this is a group function.boolean
isGroupAuxiliary()
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, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getName, getOperandCountRange, getOperandTypeChecker, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isName, leftPrec, needsSpace, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperands
-
-
-
-
Field Detail
-
groupFunction
public final SqlGroupedWindowFunction groupFunction
The grouped function, if this an auxiliary function; null otherwise.
-
-
Constructor Detail
-
SqlGroupedWindowFunction
public SqlGroupedWindowFunction(java.lang.String name, SqlKind kind, SqlGroupedWindowFunction groupFunction, SqlReturnTypeInference returnTypeInference, SqlOperandTypeInference operandTypeInference, 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(java.lang.String name, SqlKind kind, SqlGroupedWindowFunction groupFunction, SqlOperandTypeChecker operandTypeChecker)
Deprecated.
-
SqlGroupedWindowFunction
@Deprecated public SqlGroupedWindowFunction(SqlKind kind, SqlGroupedWindowFunction groupFunction, SqlOperandTypeChecker operandTypeChecker)
Deprecated.
-
-
Method Detail
-
auxiliary
public SqlGroupedWindowFunction auxiliary(SqlKind kind)
Creates an auxiliary function from this grouped window function.- Parameters:
kind
- Kind; also determines function name
-
auxiliary
public SqlGroupedWindowFunction auxiliary(java.lang.String name, SqlKind kind)
Creates an auxiliary function from this grouped window function.- Parameters:
name
- Function namekind
- Kind
-
getAuxiliaryFunctions
public java.util.List<SqlGroupedWindowFunction> 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:
SqlOperator.isGroup()
-
getMonotonicity
public SqlMonotonicity getMonotonicity(SqlOperatorBinding call)
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
-
-