public class SqlWindowTableFunction
extends org.apache.calcite.sql.SqlFunction
implements org.apache.calcite.sql.SqlTableFunction
TUMBLE
,
HOP
, CUMULATE
and SESSION
.
Note: we copied the implementation from Calcite's SqlWindowTableFunction
, but support return additional window_time
time attribute column which should keep the same type with original time attribute.
Modifier and Type | Class and Description |
---|---|
protected static class |
SqlWindowTableFunction.AbstractOperandMetadata
Partial implementation of operand type checker.
|
Modifier and Type | Field and Description |
---|---|
static org.apache.calcite.sql.type.SqlReturnTypeInference |
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.
|
protected static String |
PARAM_DATA
The data source which the table function computes with.
|
protected static String |
PARAM_KEY
The session key(s), only used for SESSION window.
|
protected static String |
PARAM_OFFSET
The optional align offset for each window.
|
protected static String |
PARAM_SIZE
The window duration INTERVAL.
|
protected static String |
PARAM_SLIDE
The slide interval, only used for HOP window.
|
protected static String |
PARAM_STEP
The slide interval, only used for HOP window.
|
protected static String |
PARAM_TIMECOL
The time attribute column.
|
Constructor and Description |
---|
SqlWindowTableFunction(String name,
org.apache.calcite.sql.type.SqlOperandMetadata operandMetadata)
Creates a window table function with a given name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
argumentMustBeScalar(int ordinal) |
org.apache.calcite.sql.type.SqlOperandMetadata |
getOperandTypeChecker() |
org.apache.calcite.sql.type.SqlReturnTypeInference |
getRowTypeInference() |
static org.apache.calcite.rel.type.RelDataType |
inferRowType(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory,
org.apache.calcite.rel.type.RelDataType inputRowType,
org.apache.calcite.rel.type.RelDataType timeAttributeType) |
deriveType, getFunctionType, getNameAsId, getParamNames, getParamTypes, getSqlIdentifier, getSyntax, isQuantifierAllowed, unparse, validateCall, validateQuantifier
acceptCall, acceptCall, adjustType, allowsFraming, checkOperandCount, checkOperandTypes, constructArgNameList, constructArgTypeList, constructOperandList, createCall, createCall, createCall, createCall, createCall, createCall, createCall, 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
protected static final String PARAM_DATA
protected static final String PARAM_TIMECOL
protected static final String PARAM_SIZE
protected static final String PARAM_OFFSET
protected static final String PARAM_KEY
protected static final String PARAM_SLIDE
protected static final String PARAM_STEP
public static final org.apache.calcite.sql.type.SqlReturnTypeInference ARG0_TABLE_FUNCTION_WINDOWING
window_start
: TIMESTAMP type to indicate a window's start
window_end
: TIMESTAMP type to indicate a window's end
window_time
: TIMESTAMP type with time attribute metadata to indicate a window's
time attribute
public SqlWindowTableFunction(String name, org.apache.calcite.sql.type.SqlOperandMetadata operandMetadata)
public org.apache.calcite.sql.type.SqlOperandMetadata getOperandTypeChecker()
getOperandTypeChecker
in class org.apache.calcite.sql.SqlOperator
public org.apache.calcite.sql.type.SqlReturnTypeInference getRowTypeInference()
getRowTypeInference
in interface org.apache.calcite.sql.SqlTableFunction
public boolean argumentMustBeScalar(int ordinal)
Overrides because the first parameter of table-value function windowing is an explicit TABLE parameter, which is not scalar.
argumentMustBeScalar
in class org.apache.calcite.sql.SqlOperator
public static org.apache.calcite.rel.type.RelDataType inferRowType(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, org.apache.calcite.rel.type.RelDataType inputRowType, org.apache.calcite.rel.type.RelDataType timeAttributeType)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.