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
Nested ClassesModifier and TypeClassDescriptionprotected static classPartial implementation of operand type checker. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SqlReturnTypeInferenceType-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 StringThe data source which the table function computes with.protected static final StringThe session key(s), only used for SESSION window.protected static final StringThe optional align offset for each window.protected static final StringThe window duration INTERVAL.protected static final StringThe slide interval, only used for HOP window.protected static final StringThe time attribute column.Fields inherited from class org.apache.calcite.sql.SqlOperator
kind, MDX_PRECEDENCE, NL -
Constructor Summary
ConstructorsConstructorDescriptionSqlWindowTableFunction(String name, SqlOperandMetadata operandMetadata) Creates a window table function with a given name. -
Method Summary
Modifier and TypeMethodDescriptionbooleanargumentMustBeScalar(int ordinal) Returns whether theordinalth argument to this operator must be scalar (as opposed to a query).@Nullable SqlOperandMetadataReturns 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, validateQuantifierMethods 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, getSqlCallFactory, getStrongPolicyInference, hashCode, inferReturnType, inferReturnType, isAggregator, isDeterministic, isDynamicFunction, isGroup, isGroupAuxiliary, isName, isSymmetrical, leftPrec, not, preValidateCall, requiresDecimalExpansion, requiresOrder, requiresOver, reverse, rewriteCall, rightPrec, toString, unparseListClause, unparseListClause, validateOperands, validRexOperandsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
getOperandTypeCheckerin classSqlOperator
-
getRowTypeInference
Description copied from interface:SqlTableFunctionReturns 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:
getRowTypeInferencein interfaceSqlTableFunction- Returns:
- strategy to infer the row type of a call to this function
-
argumentMustBeScalar
public boolean argumentMustBeScalar(int ordinal) Returns whether theordinalth 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
SELECTandEXISTSoverride this method.Overrides because the first parameter of table-value function windowing is an explicit TABLE parameter, which is not scalar.
- Overrides:
argumentMustBeScalarin classSqlOperator
-