Package org.apache.calcite.sql.validate
Interface SqlValidatorWithHints
- All Superinterfaces:
SqlValidator
- All Known Implementing Classes:
CalciteSqlValidator
,ContextSqlValidator
,SqlAdvisorValidator
,SqlValidatorImpl
Extends
SqlValidator
to allow discovery of useful data such as fully
qualified names of SQL objects, alternative valid SQL objects that can be
used in the SQL statement (dubbed as hints).-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.calcite.sql.validate.SqlValidator
SqlValidator.Config
-
Method Summary
Modifier and TypeMethodDescriptionlookupHints
(SqlNode topNode, SqlParserPos pos) Looks up completion hints for a syntactically correct SQL statement that has been parsed into an expression tree.@Nullable SqlMoniker
lookupQualifiedName
(SqlNode topNode, SqlParserPos pos) Looks up the fully qualified name for aSqlIdentifier
at a given Parser Position in a parsed expression tree Note: call this only afterSqlValidator.validate(org.apache.calcite.sql.SqlNode)
has been called.Methods inherited from interface org.apache.calcite.sql.validate.SqlValidator
config, declareCursor, deriveAlias, deriveConstructorType, deriveType, expand, expandOrderExpr, expandStar, getCatalogReader, getEmptyScope, getFieldOrigins, getFromScope, getGroupScope, getHavingScope, getJoinScope, getLambdaScope, getMatchRecognizeScope, getMeasureScope, getNamespace, getOperatorTable, getOrderScope, getOverScope, getParameterRowType, getParentCursor, getRawSelectScope, getSelectScope, getTimeFrameSet, getTypeCoercion, getTypeFactory, getTypeMappingRule, getUnknownType, getValidatedNodeType, getValidatedNodeTypeIfKnown, getValidatedOperandTypes, getWhereScope, getWithScope, handleUnresolvedFunction, isAggregate, isAggregate, isSystemField, makeNullaryCall, newValidationError, popFunctionCall, pushFunctionCall, removeValidatedNodeType, resolveLiteral, resolveWindow, resolveWindow, setValidatedNodeType, transform, validate, validateAggregateParams, validateCall, validateDataType, validateDelete, validateDynamicParam, validateIdentifier, validateInsert, validateIntervalQualifier, validateLambda, validateLiteral, validateMatchRecognize, validateMerge, validateModality, validateParameterizedExpression, validateQuery, validateSequenceValue, validateTimeFrame, validateUpdate, validateWindow, validateWith, validateWithItem
-
Method Details
-
lookupHints
Looks up completion hints for a syntactically correct SQL statement that has been parsed into an expression tree. (Note this should be called afterSqlValidator.validate(org.apache.calcite.sql.SqlNode)
.- Parameters:
topNode
- top of expression tree in which to lookup completion hintspos
- indicates the position in the sql statement we want to get completion hints for. For example, "select a.ename, b.deptno from sales.emp a join sales.dept b "on a.deptno=b.deptno where empno=1"; setting pos to 'Line 1, Column 17' returns all the possible column names that can be selected from sales.dept table setting pos to 'Line 1, Column 31' returns all the possible table names in 'sales' schema- Returns:
- an array of
SqlMoniker
(sql identifiers) that can fill in at the indicated position
-
lookupQualifiedName
Looks up the fully qualified name for aSqlIdentifier
at a given Parser Position in a parsed expression tree Note: call this only afterSqlValidator.validate(org.apache.calcite.sql.SqlNode)
has been called.- Parameters:
topNode
- top of expression tree in which to lookup the qualified name for the SqlIdentifierpos
- indicates the position of theSqlIdentifier
in the SQL statement we want to get the qualified name for- Returns:
- a string of the fully qualified name of the
SqlIdentifier
if the Parser position represents a validSqlIdentifier
. Else return null
-