Package org.apache.calcite.sql
Class SqlWindowTableFunction
java.lang.Object
org.apache.calcite.sql.SqlOperator
org.apache.calcite.sql.SqlFunction
org.apache.calcite.sql.SqlWindowTableFunction
- All Implemented Interfaces:
SqlTableFunction
- Direct Known Subclasses:
SqlHopTableFunction
,SqlSessionTableFunction
,SqlTumbleTableFunction
Base class for a table-valued function that computes windows. Examples
include
TUMBLE
, HOP
and SESSION
.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Partial implementation of operand type checker. -
Field Summary
Modifier and TypeFieldDescriptionstatic final SqlReturnTypeInference
Type-inference strategy whereby the row type of a table function call is a ROW, which is combined from the row type of operand #0 (which is a TABLE) and two additional fields.protected static final String
The data source which the table function computes with.protected static final String
The session key(s), only used for SESSION window.protected static final String
The optional align offset for each window.protected static final String
The window duration INTERVAL.protected static final String
The slide interval, only used for HOP window.protected static final String
The time attribute column.Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL
-
Constructor Summary
ConstructorDescriptionSqlWindowTableFunction
(String name, SqlOperandMetadata operandMetadata) Creates a window table function with a given name. -
Method Summary
Modifier and TypeMethodDescriptionboolean
argumentMustBeScalar
(int ordinal) Returns whether theordinal
th argument to this operator must be scalar (as opposed to a query).@Nullable SqlOperandMetadata
Returns the record type of the table yielded by this function when applied to given arguments.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, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, deriveOperandType, equals, getAllowedSignatures, getAllowedSignatures, getKind, getLeftPrec, getMonotonicity, getMonotonicity, getName, getOperandCountRange, getOperandTypeInference, getReturnTypeInference, getRightPrec, getSignatureTemplate, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperands
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.calcite.sql.SqlTableFunction
tableCharacteristic
-
Field Details
-
PARAM_DATA
The data source which the table function computes with.- See Also:
-
PARAM_TIMECOL
The time attribute column. Also known as the event time.- See Also:
-
PARAM_SIZE
The window duration INTERVAL.- See Also:
-
PARAM_OFFSET
The optional align offset for each window.- See Also:
-
PARAM_KEY
The session key(s), only used for SESSION window.- See Also:
-
PARAM_SLIDE
The slide interval, only used for HOP window.- See Also:
-
ARG0_TABLE_FUNCTION_WINDOWING
Type-inference strategy whereby the row type of a table function call is a ROW, which is combined from the row type of operand #0 (which is a TABLE) and two additional fields. The fields are as follows:window_start
: TIMESTAMP type to indicate a window's startwindow_end
: TIMESTAMP type to indicate a window's end
-
-
Constructor Details
-
SqlWindowTableFunction
Creates a window table function with a given name.
-
-
Method Details
-
getOperandTypeChecker
- Overrides:
getOperandTypeChecker
in classSqlOperator
-
getRowTypeInference
Description copied from interface:SqlTableFunction
Returns the record type of the table yielded by this function when applied to given arguments. Only literal arguments are passed, non-literal are replaced with default values (null, 0, false, etc).- Specified by:
getRowTypeInference
in interfaceSqlTableFunction
- Returns:
- strategy to infer the row type of a call to this function
-
argumentMustBeScalar
public boolean argumentMustBeScalar(int ordinal) Returns whether theordinal
th argument to this operator must be scalar (as opposed to a query).If true (the default), the validator will attempt to convert the argument into a scalar sub-query, which must have one column and return at most one row.
Operators such as
SELECT
andEXISTS
override this method.Overrides because the first parameter of table-value function windowing is an explicit TABLE parameter, which is not scalar.
- Overrides:
argumentMustBeScalar
in classSqlOperator
-