Class FlinkCalciteSqlValidator
- java.lang.Object
-
- org.apache.calcite.sql.validate.SqlValidatorImpl
-
- org.apache.flink.table.planner.calcite.FlinkCalciteSqlValidator
-
- All Implemented Interfaces:
org.apache.calcite.sql.validate.SqlValidator
,org.apache.calcite.sql.validate.SqlValidatorWithHints
@Internal public final class FlinkCalciteSqlValidator extends SqlValidatorImpl
Extends Calcite'sSqlValidator
by Flink-specific behavior.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.calcite.sql.validate.SqlValidatorImpl
SqlValidatorImpl.DmlNamespace, SqlValidatorImpl.FunctionParamInfo, SqlValidatorImpl.IdInfo, SqlValidatorImpl.Status
-
-
Field Summary
-
Fields inherited from class org.apache.calcite.sql.validate.SqlValidatorImpl
callToOperandTypesMap, functionCallStack, idPositions, namespaces, scopes, timeFrameSet, TRACER, typeFactory, unknownType, UPDATE_ANON_PREFIX, UPDATE_SRC_ALIAS, UPDATE_TGT_ALIAS
-
-
Constructor Summary
Constructors Constructor Description FlinkCalciteSqlValidator(org.apache.calcite.sql.SqlOperatorTable opTab, org.apache.calcite.sql.validate.SqlValidatorCatalogReader catalogReader, org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, org.apache.calcite.sql.validate.SqlValidator.Config config, org.apache.calcite.plan.RelOptTable.ToRelContext toRelcontext, org.apache.calcite.plan.RelOptCluster relOptCluster, org.apache.calcite.tools.FrameworkConfig frameworkConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addToSelectList(List<org.apache.calcite.sql.SqlNode> list, Set<String> aliases, List<Map.Entry<String,org.apache.calcite.rel.type.RelDataType>> fieldList, org.apache.calcite.sql.SqlNode exp, org.apache.calcite.sql.validate.SelectScope scope, boolean includeSystemVars)
Adds an expression to a select list, ensuring that its alias does not clash with any existing expressions on the list.Optional<org.apache.calcite.rel.type.RelDataType>
getExpectedOutputType(org.apache.calcite.sql.SqlNode sqlNode)
protected @PolyNull org.apache.calcite.sql.SqlNode
performUnconditionalRewrites(@PolyNull org.apache.calcite.sql.SqlNode node, boolean underFrom)
Performs expression rewrites which are always used unconditionally.protected void
registerNamespace(@Nullable org.apache.calcite.sql.validate.SqlValidatorScope usingScope, @Nullable String alias, org.apache.calcite.sql.validate.SqlValidatorNamespace ns, boolean forceNullable)
Registers a new namespace, and adds it as a child of its parent scope.void
setExpectedOutputType(org.apache.calcite.sql.SqlNode sqlNode, org.apache.calcite.rel.type.RelDataType expectedOutputType)
void
validateColumnListParams(org.apache.calcite.sql.SqlFunction function, List<org.apache.calcite.rel.type.RelDataType> argTypes, List<org.apache.calcite.sql.SqlNode> operands)
protected void
validateJoin(SqlJoin join, org.apache.calcite.sql.validate.SqlValidatorScope scope)
void
validateLiteral(org.apache.calcite.sql.SqlLiteral literal)
-
Methods inherited from class org.apache.calcite.sql.validate.SqlValidatorImpl
checkTypeAssignment, config, createMatchRecognizeNameSpace, createPivotNameSpace, createSelectNamespace, createSetopNamespace, createSourceSelectForDelete, createSourceSelectForUpdate, createTargetRowType, createUnpivotNameSpace, declareCursor, deriveAlias, deriveConstructorType, deriveType, expand, expandOrderExpr, expandSelectExpr, expandStar, extendedExpandGroupBy, getAggregate, getCatalogReader, getConformance, getCursorScope, getEmptyScope, getFieldOrigins, getFromScope, getGroupScope, getHavingScope, getJoinScope, getLogicalSourceRowType, getLogicalTargetRowType, getMatchRecognizeScope, getNamespace, getOperatorTable, getOrderScope, getOriginal, getOverScope, getParameterRowType, getParentCursor, getRawSelectScope, getSelectScope, getSelfJoinExprForUpdate, getTimeFrameSet, getTypeCoercion, getTypeFactory, getUnknownType, getValidatedNodeType, getValidatedNodeTypeIfKnown, getValidatedOperandTypes, getValidationErrorFunction, getWhereScope, getWindowByName, getWithScope, handleUnresolvedFunction, inferUnknownTypes, isAggregate, isAggregate, isNestedAggregateWindow, isOverAggregateWindow, isSystemField, lookupHints, lookupNameCompletionHints, lookupQualifiedName, makeNullaryCall, newValidationError, popFunctionCall, pushFunctionCall, removeValidatedNodeType, resolveLiteral, resolveWindow, setOriginal, setValidatedNodeType, shouldAllowIntermediateOrderBy, shouldAllowOverRelation, transform, usingNames, validate, validateAggregateParams, validateCall, validateDataType, validateDelete, validateDynamicParam, validateFeature, validateFrom, validateGroupClause, validateHavingClause, validateIdentifier, validateInsert, validateIntervalQualifier, validateMatchRecognize, validateMerge, validateModality, validateNamespace, validateOrderList, validateOver, validateParameterizedExpression, validatePivot, validateQualifyClause, validateQuery, validateSelect, validateSelectList, validateSequenceValue, validateTableFunction, validateTimeFrame, validateUnnest, validateUnpivot, validateUpdate, validateValues, validateWhereClause, validateWhereOrOn, validateWindow, validateWindowClause, validateWith, validateWithItem
-
-
-
-
Constructor Detail
-
FlinkCalciteSqlValidator
public FlinkCalciteSqlValidator(org.apache.calcite.sql.SqlOperatorTable opTab, org.apache.calcite.sql.validate.SqlValidatorCatalogReader catalogReader, org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, org.apache.calcite.sql.validate.SqlValidator.Config config, org.apache.calcite.plan.RelOptTable.ToRelContext toRelcontext, org.apache.calcite.plan.RelOptCluster relOptCluster, org.apache.calcite.tools.FrameworkConfig frameworkConfig)
-
-
Method Detail
-
setExpectedOutputType
public void setExpectedOutputType(org.apache.calcite.sql.SqlNode sqlNode, org.apache.calcite.rel.type.RelDataType expectedOutputType)
-
getExpectedOutputType
public Optional<org.apache.calcite.rel.type.RelDataType> getExpectedOutputType(org.apache.calcite.sql.SqlNode sqlNode)
-
validateLiteral
public void validateLiteral(org.apache.calcite.sql.SqlLiteral literal)
- Specified by:
validateLiteral
in interfaceorg.apache.calcite.sql.validate.SqlValidator
- Overrides:
validateLiteral
in classSqlValidatorImpl
-
validateJoin
protected void validateJoin(SqlJoin join, org.apache.calcite.sql.validate.SqlValidatorScope scope)
- Overrides:
validateJoin
in classSqlValidatorImpl
-
validateColumnListParams
public void validateColumnListParams(org.apache.calcite.sql.SqlFunction function, List<org.apache.calcite.rel.type.RelDataType> argTypes, List<org.apache.calcite.sql.SqlNode> operands)
- Specified by:
validateColumnListParams
in interfaceorg.apache.calcite.sql.validate.SqlValidator
- Overrides:
validateColumnListParams
in classSqlValidatorImpl
-
registerNamespace
protected void registerNamespace(@Nullable org.apache.calcite.sql.validate.SqlValidatorScope usingScope, @Nullable String alias, org.apache.calcite.sql.validate.SqlValidatorNamespace ns, boolean forceNullable)
Description copied from class:SqlValidatorImpl
Registers a new namespace, and adds it as a child of its parent scope. Derived class can override this method to tinker with namespaces as they are created.- Overrides:
registerNamespace
in classSqlValidatorImpl
- Parameters:
usingScope
- Parent scope (which will want to look for things in this namespace)alias
- Alias by which parent will refer to this namespacens
- NamespaceforceNullable
- Whether to force the type of namespace to be nullable
-
addToSelectList
protected void addToSelectList(List<org.apache.calcite.sql.SqlNode> list, Set<String> aliases, List<Map.Entry<String,org.apache.calcite.rel.type.RelDataType>> fieldList, org.apache.calcite.sql.SqlNode exp, org.apache.calcite.sql.validate.SelectScope scope, boolean includeSystemVars)
Description copied from class:SqlValidatorImpl
Adds an expression to a select list, ensuring that its alias does not clash with any existing expressions on the list.- Overrides:
addToSelectList
in classSqlValidatorImpl
-
performUnconditionalRewrites
protected @PolyNull org.apache.calcite.sql.SqlNode performUnconditionalRewrites(@PolyNull org.apache.calcite.sql.SqlNode node, boolean underFrom)
Description copied from class:SqlValidatorImpl
Performs expression rewrites which are always used unconditionally. These rewrites massage the expression tree into a standard form so that the rest of the validation logic can be simpler.Returns null if and only if the original expression is null.
- Overrides:
performUnconditionalRewrites
in classSqlValidatorImpl
- Parameters:
node
- expression to be rewrittenunderFrom
- whether node appears directly under a FROM clause- Returns:
- rewritten expression, or null if the original expression is null
-
-