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
Extends Calcite's
SqlValidator 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.StatusNested classes/interfaces inherited from interface org.apache.calcite.sql.validate.SqlValidator
org.apache.calcite.sql.validate.SqlValidator.Config -
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
ConstructorsConstructorDescriptionFlinkCalciteSqlValidator(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
Modifier and TypeMethodDescriptionprotected voidaddToSelectList(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.SqlNodeperformUnconditionalRewrites(@PolyNull org.apache.calcite.sql.SqlNode node, boolean underFrom) Performs expression rewrites which are always used unconditionally.protected voidregisterNamespace(@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.voidsetExpectedOutputType(org.apache.calcite.sql.SqlNode sqlNode, org.apache.calcite.rel.type.RelDataType expectedOutputType) voidvalidateColumnListParams(org.apache.calcite.sql.SqlFunction function, List<org.apache.calcite.rel.type.RelDataType> argTypes, List<org.apache.calcite.sql.SqlNode> operands) protected voidvalidateJoin(org.apache.calcite.sql.SqlJoin join, org.apache.calcite.sql.validate.SqlValidatorScope scope) voidvalidateLiteral(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, validateWithItemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.calcite.sql.validate.SqlValidator
resolveWindow
-
Constructor Details
-
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 Details
-
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:
validateLiteralin interfaceorg.apache.calcite.sql.validate.SqlValidator- Overrides:
validateLiteralin classSqlValidatorImpl
-
validateJoin
protected void validateJoin(org.apache.calcite.sql.SqlJoin join, org.apache.calcite.sql.validate.SqlValidatorScope scope) - Overrides:
validateJoinin 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:
validateColumnListParamsin interfaceorg.apache.calcite.sql.validate.SqlValidator- Overrides:
validateColumnListParamsin 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:SqlValidatorImplRegisters 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:
registerNamespacein 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:SqlValidatorImplAdds an expression to a select list, ensuring that its alias does not clash with any existing expressions on the list.- Overrides:
addToSelectListin classSqlValidatorImpl
-
performUnconditionalRewrites
protected @PolyNull org.apache.calcite.sql.SqlNode performUnconditionalRewrites(@PolyNull org.apache.calcite.sql.SqlNode node, boolean underFrom) Description copied from class:SqlValidatorImplPerforms 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:
performUnconditionalRewritesin 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
-