Class SqlValidatorImpl
- java.lang.Object
-
- org.apache.calcite.sql.validate.SqlValidatorImpl
-
- All Implemented Interfaces:
org.apache.calcite.sql.validate.SqlValidator
,org.apache.calcite.sql.validate.SqlValidatorWithHints
- Direct Known Subclasses:
FlinkCalciteSqlValidator
,SqlValidatorWithSnapshot
public class SqlValidatorImpl extends Object implements org.apache.calcite.sql.validate.SqlValidatorWithHints
Default implementation ofSqlValidator
, the class was copied over because of CALCITE-4554.Lines 1961 ~ 1981, Flink improves error message for functions without appropriate arguments in handleUnresolvedFunction at
handleUnresolvedFunction(org.apache.calcite.sql.SqlCall, org.apache.calcite.sql.SqlOperator, java.util.List<org.apache.calcite.rel.type.RelDataType>, java.util.List<java.lang.String>)
.Lines 3739 ~ 3743, 6333 ~ 6339, Flink improves validating the SqlCall that uses named parameters, rearrange the order of sub-operands, and fill in missing operands with the default node.
Lines 5111 ~ 5124, Flink enables TIMESTAMP and TIMESTAMP_LTZ for system time period specification type at
validateSnapshot(org.apache.calcite.sql.SqlNode, org.apache.calcite.sql.validate.SqlValidatorScope, org.apache.calcite.sql.validate.SqlValidatorNamespace)
.Lines 5468 ~ 5474, Flink enables TIMESTAMP and TIMESTAMP_LTZ for first orderBy column in matchRecognize at
validateMatchRecognize(org.apache.calcite.sql.SqlCall)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SqlValidatorImpl.DmlNamespace
Common base class for DML statement namespaces.protected static class
SqlValidatorImpl.FunctionParamInfo
Utility object used to maintain information about the parameters in a function call.protected static class
SqlValidatorImpl.IdInfo
Information about an identifier in a particular scope.static class
SqlValidatorImpl.Status
Validation status.
-
Field Summary
Fields Modifier and Type Field Description IdentityHashMap<org.apache.calcite.sql.SqlCall,List<org.apache.calcite.rel.type.RelDataType>>
callToOperandTypesMap
Provides the data forgetValidatedOperandTypes(SqlCall)
.protected Deque<SqlValidatorImpl.FunctionParamInfo>
functionCallStack
Stack of objects that maintain information about function calls.protected Map<String,SqlValidatorImpl.IdInfo>
idPositions
MapsSqlParserPos
strings to theSqlIdentifier
identifier objects at these positions.protected IdentityHashMap<org.apache.calcite.sql.SqlNode,org.apache.calcite.sql.validate.SqlValidatorNamespace>
namespaces
Maps anode
to thenamespace
which describes what columns they contain.protected IdentityHashMap<org.apache.calcite.sql.SqlNode,org.apache.calcite.sql.validate.SqlValidatorScope>
scopes
Mapsquery node
objects to theSqlValidatorScope
scope created from them.static org.slf4j.Logger
TRACER
protected org.apache.calcite.rel.type.RelDataTypeFactory
typeFactory
protected org.apache.calcite.rel.type.RelDataType
unknownType
The type of dynamic parameters until a type is imposed on them.static String
UPDATE_ANON_PREFIX
Alias prefix generated for source columns when rewriting UPDATE to MERGE.static String
UPDATE_SRC_ALIAS
Alias generated for the source table when rewriting UPDATE to MERGE.static String
UPDATE_TGT_ALIAS
Alias generated for the target table when rewriting UPDATE to MERGE if no alias was specified by the user.
-
Constructor Summary
Constructors Modifier Constructor Description protected
SqlValidatorImpl(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)
Creates a validator.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated 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.protected void
checkTypeAssignment(@Nullable org.apache.calcite.sql.validate.SqlValidatorScope sourceScope, org.apache.calcite.sql.validate.SqlValidatorTable table, org.apache.calcite.rel.type.RelDataType sourceRowType, org.apache.calcite.rel.type.RelDataType targetRowType, org.apache.calcite.sql.SqlNode query)
Checks the type assignment of an INSERT or UPDATE query.org.apache.calcite.sql.validate.SqlValidator.Config
config()
protected org.apache.calcite.sql.validate.MatchRecognizeNamespace
createMatchRecognizeNameSpace(org.apache.calcite.sql.SqlMatchRecognize call, org.apache.calcite.sql.SqlNode enclosingNode)
protected org.apache.calcite.sql.validate.PivotNamespace
createPivotNameSpace(org.apache.calcite.sql.SqlPivot call, org.apache.calcite.sql.SqlNode enclosingNode)
protected org.apache.calcite.sql.validate.SelectNamespace
createSelectNamespace(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.SqlNode enclosingNode)
Creates a namespace for aSELECT
node.protected org.apache.calcite.sql.validate.SetopNamespace
createSetopNamespace(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.SqlNode enclosingNode)
Creates a namespace for a set operation (UNION
,INTERSECT
, orEXCEPT
).protected org.apache.calcite.sql.SqlSelect
createSourceSelectForDelete(org.apache.calcite.sql.SqlDelete call)
Creates the SELECT statement that putatively feeds rows into a DELETE statement to be deleted.protected org.apache.calcite.sql.SqlSelect
createSourceSelectForUpdate(org.apache.calcite.sql.SqlUpdate call)
Creates the SELECT statement that putatively feeds rows into an UPDATE statement to be updated.protected org.apache.calcite.rel.type.RelDataType
createTargetRowType(org.apache.calcite.sql.validate.SqlValidatorTable table, @Nullable org.apache.calcite.sql.SqlNodeList targetColumnList, boolean append)
Derives a row-type for INSERT and UPDATE operations.protected org.apache.calcite.sql.validate.UnpivotNamespace
createUnpivotNameSpace(org.apache.calcite.sql.SqlUnpivot call, org.apache.calcite.sql.SqlNode enclosingNode)
void
declareCursor(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.validate.SqlValidatorScope parentScope)
@Nullable String
deriveAlias(org.apache.calcite.sql.SqlNode node, int ordinal)
org.apache.calcite.rel.type.RelDataType
deriveConstructorType(org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.SqlFunction unresolvedConstructor, @Nullable org.apache.calcite.sql.SqlFunction resolvedConstructor, List<org.apache.calcite.rel.type.RelDataType> argTypes)
org.apache.calcite.rel.type.RelDataType
deriveType(org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlNode expr)
org.apache.calcite.sql.SqlNode
expand(org.apache.calcite.sql.SqlNode expr, org.apache.calcite.sql.validate.SqlValidatorScope scope)
org.apache.calcite.sql.SqlNode
expandGroupByOrHavingExpr(org.apache.calcite.sql.SqlNode expr, org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlSelect select, boolean havingExpression)
org.apache.calcite.sql.SqlNode
expandOrderExpr(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.SqlNode orderExpr)
org.apache.calcite.sql.SqlNode
expandSelectExpr(org.apache.calcite.sql.SqlNode expr, org.apache.calcite.sql.validate.SelectScope scope, org.apache.calcite.sql.SqlSelect select)
org.apache.calcite.sql.SqlNodeList
expandStar(org.apache.calcite.sql.SqlNodeList selectList, org.apache.calcite.sql.SqlSelect select, boolean includeSystemVars)
protected @Nullable org.apache.calcite.sql.SqlNode
getAggregate(org.apache.calcite.sql.SqlSelect select)
Returns the parse tree node (GROUP BY, HAVING, or an aggregate function call) that causesselect
to be an aggregate query, or null if it is not an aggregate query.org.apache.calcite.sql.validate.SqlValidatorCatalogReader
getCatalogReader()
org.apache.calcite.sql.validate.SqlConformance
getConformance()
org.apache.calcite.sql.validate.SqlValidatorScope
getCursorScope(org.apache.calcite.sql.SqlSelect select)
org.apache.calcite.sql.validate.SqlValidatorScope
getEmptyScope()
List<@Nullable List<String>>
getFieldOrigins(org.apache.calcite.sql.SqlNode sqlQuery)
@Nullable org.apache.calcite.sql.validate.SqlValidatorScope
getFromScope(org.apache.calcite.sql.SqlSelect select)
org.apache.calcite.sql.validate.SqlValidatorScope
getGroupScope(org.apache.calcite.sql.SqlSelect select)
org.apache.calcite.sql.validate.SqlValidatorScope
getHavingScope(org.apache.calcite.sql.SqlSelect select)
@Nullable org.apache.calcite.sql.validate.SqlValidatorScope
getJoinScope(org.apache.calcite.sql.SqlNode node)
protected org.apache.calcite.rel.type.RelDataType
getLogicalSourceRowType(org.apache.calcite.rel.type.RelDataType sourceRowType, org.apache.calcite.sql.SqlInsert insert)
protected org.apache.calcite.rel.type.RelDataType
getLogicalTargetRowType(org.apache.calcite.rel.type.RelDataType targetRowType, org.apache.calcite.sql.SqlInsert insert)
org.apache.calcite.sql.validate.SqlValidatorScope
getMatchRecognizeScope(org.apache.calcite.sql.SqlMatchRecognize node)
@Nullable org.apache.calcite.sql.validate.SqlValidatorNamespace
getNamespace(org.apache.calcite.sql.SqlNode node)
org.apache.calcite.sql.SqlOperatorTable
getOperatorTable()
org.apache.calcite.sql.validate.SqlValidatorScope
getOrderScope(org.apache.calcite.sql.SqlSelect select)
org.apache.calcite.sql.SqlNode
getOriginal(org.apache.calcite.sql.SqlNode expr)
org.apache.calcite.sql.validate.SqlValidatorScope
getOverScope(org.apache.calcite.sql.SqlNode node)
org.apache.calcite.rel.type.RelDataType
getParameterRowType(org.apache.calcite.sql.SqlNode sqlQuery)
@Nullable String
getParentCursor(String columnListParamName)
@Nullable org.apache.calcite.sql.validate.SelectScope
getRawSelectScope(org.apache.calcite.sql.SqlSelect select)
org.apache.calcite.sql.validate.SqlValidatorScope
getSelectScope(org.apache.calcite.sql.SqlSelect select)
protected @Nullable org.apache.calcite.sql.SqlNode
getSelfJoinExprForUpdate(org.apache.calcite.sql.SqlNode table, String alias)
Allows a subclass to provide information about how to convert an UPDATE into a MERGE via self-join.org.apache.calcite.sql.validate.implicit.TypeCoercion
getTypeCoercion()
org.apache.calcite.rel.type.RelDataTypeFactory
getTypeFactory()
org.apache.calcite.rel.type.RelDataType
getUnknownType()
org.apache.calcite.rel.type.RelDataType
getValidatedNodeType(org.apache.calcite.sql.SqlNode node)
@Nullable org.apache.calcite.rel.type.RelDataType
getValidatedNodeTypeIfKnown(org.apache.calcite.sql.SqlNode node)
@Nullable List<org.apache.calcite.rel.type.RelDataType>
getValidatedOperandTypes(org.apache.calcite.sql.SqlCall call)
org.apache.calcite.sql.validate.SqlValidatorImpl.ValidationErrorFunction
getValidationErrorFunction()
org.apache.calcite.sql.validate.SqlValidatorScope
getWhereScope(org.apache.calcite.sql.SqlSelect select)
protected org.apache.calcite.sql.SqlWindow
getWindowByName(org.apache.calcite.sql.SqlIdentifier id, org.apache.calcite.sql.validate.SqlValidatorScope scope)
@Nullable org.apache.calcite.sql.validate.SqlValidatorScope
getWithScope(org.apache.calcite.sql.SqlNode withItem)
org.apache.calcite.runtime.CalciteException
handleUnresolvedFunction(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.SqlOperator unresolvedFunction, List<org.apache.calcite.rel.type.RelDataType> argTypes, @Nullable List<String> argNames)
protected void
inferUnknownTypes(org.apache.calcite.rel.type.RelDataType inferredType, org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlNode node)
boolean
isAggregate(org.apache.calcite.sql.SqlNode selectNode)
Deprecated.boolean
isAggregate(org.apache.calcite.sql.SqlSelect select)
protected boolean
isNestedAggregateWindow(org.apache.calcite.sql.SqlNode node)
protected boolean
isOverAggregateWindow(org.apache.calcite.sql.SqlNode node)
boolean
isSystemField(org.apache.calcite.rel.type.RelDataTypeField field)
List<org.apache.calcite.sql.validate.SqlMoniker>
lookupHints(org.apache.calcite.sql.SqlNode topNode, org.apache.calcite.sql.parser.SqlParserPos pos)
void
lookupNameCompletionHints(org.apache.calcite.sql.validate.SqlValidatorScope scope, List<String> names, org.apache.calcite.sql.parser.SqlParserPos pos, Collection<org.apache.calcite.sql.validate.SqlMoniker> hintList)
Populates a list of all the valid alternatives for an identifier.@Nullable org.apache.calcite.sql.validate.SqlMoniker
lookupQualifiedName(org.apache.calcite.sql.SqlNode topNode, org.apache.calcite.sql.parser.SqlParserPos pos)
@Nullable org.apache.calcite.sql.SqlCall
makeNullaryCall(org.apache.calcite.sql.SqlIdentifier id)
org.apache.calcite.runtime.CalciteContextException
newValidationError(org.apache.calcite.sql.SqlNode node, org.apache.calcite.runtime.Resources.ExInst<org.apache.calcite.sql.validate.SqlValidatorException> e)
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.void
popFunctionCall()
void
pushFunctionCall()
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
removeValidatedNodeType(org.apache.calcite.sql.SqlNode node)
org.apache.calcite.sql.SqlWindow
resolveWindow(org.apache.calcite.sql.SqlNode windowOrRef, org.apache.calcite.sql.validate.SqlValidatorScope scope)
void
setOriginal(org.apache.calcite.sql.SqlNode expr, org.apache.calcite.sql.SqlNode original)
void
setValidatedNodeType(org.apache.calcite.sql.SqlNode node, org.apache.calcite.rel.type.RelDataType type)
Saves the type of aSqlNode
, now that it has been validated.protected boolean
shouldAllowIntermediateOrderBy()
protected boolean
shouldAllowOverRelation()
org.apache.calcite.sql.validate.SqlValidator
transform(UnaryOperator<org.apache.calcite.sql.validate.SqlValidator.Config> transform)
@Nullable List<String>
usingNames(SqlJoin join)
Returns the set of field names in the join condition specified by USING or implicitly by NATURAL, de-duplicated and in order.org.apache.calcite.sql.SqlNode
validate(org.apache.calcite.sql.SqlNode topNode)
void
validateAggregateParams(org.apache.calcite.sql.SqlCall aggCall, @Nullable org.apache.calcite.sql.SqlNode filter, @Nullable org.apache.calcite.sql.SqlNodeList distinctList, @Nullable org.apache.calcite.sql.SqlNodeList orderList, org.apache.calcite.sql.validate.SqlValidatorScope scope)
void
validateCall(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidatorScope scope)
void
validateColumnListParams(org.apache.calcite.sql.SqlFunction function, List<org.apache.calcite.rel.type.RelDataType> argTypes, List<org.apache.calcite.sql.SqlNode> operands)
void
validateDataType(org.apache.calcite.sql.SqlDataTypeSpec dataType)
void
validateDelete(org.apache.calcite.sql.SqlDelete call)
void
validateDynamicParam(org.apache.calcite.sql.SqlDynamicParam dynamicParam)
protected void
validateFeature(org.apache.calcite.runtime.Feature feature, org.apache.calcite.sql.parser.SqlParserPos context)
Validates that a particular feature is enabled.protected void
validateFrom(org.apache.calcite.sql.SqlNode node, org.apache.calcite.rel.type.RelDataType targetRowType, org.apache.calcite.sql.validate.SqlValidatorScope scope)
Validates the FROM clause of a query, or (recursively) a child node of the FROM clause: AS, OVER, JOIN, VALUES, or sub-query.protected void
validateGroupClause(org.apache.calcite.sql.SqlSelect select)
Validates the GROUP BY clause of a SELECT statement.protected void
validateHavingClause(org.apache.calcite.sql.SqlSelect select)
void
validateIdentifier(org.apache.calcite.sql.SqlIdentifier id, org.apache.calcite.sql.validate.SqlValidatorScope scope)
void
validateInsert(org.apache.calcite.sql.SqlInsert insert)
void
validateIntervalQualifier(org.apache.calcite.sql.SqlIntervalQualifier qualifier)
protected void
validateJoin(SqlJoin join, org.apache.calcite.sql.validate.SqlValidatorScope scope)
void
validateLiteral(org.apache.calcite.sql.SqlLiteral literal)
void
validateMatchRecognize(org.apache.calcite.sql.SqlCall call)
void
validateMerge(org.apache.calcite.sql.SqlMerge call)
boolean
validateModality(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.validate.SqlModality modality, boolean fail)
protected void
validateNamespace(org.apache.calcite.sql.validate.SqlValidatorNamespace namespace, org.apache.calcite.rel.type.RelDataType targetRowType)
Validates a namespace.protected void
validateOrderList(org.apache.calcite.sql.SqlSelect select)
Validates the ORDER BY clause of a SELECT statement.protected void
validateOver(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidatorScope scope)
org.apache.calcite.sql.SqlNode
validateParameterizedExpression(org.apache.calcite.sql.SqlNode topNode, Map<String,org.apache.calcite.rel.type.RelDataType> nameToTypeMap)
void
validatePivot(org.apache.calcite.sql.SqlPivot pivot)
void
validateQuery(org.apache.calcite.sql.SqlNode node, @Nullable org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.rel.type.RelDataType targetRowType)
protected void
validateSelect(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.rel.type.RelDataType targetRowType)
Validates a SELECT statement.protected org.apache.calcite.rel.type.RelDataType
validateSelectList(org.apache.calcite.sql.SqlNodeList selectItems, org.apache.calcite.sql.SqlSelect select, org.apache.calcite.rel.type.RelDataType targetRowType)
void
validateSequenceValue(org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlIdentifier id)
protected void
validateTableFunction(org.apache.calcite.sql.SqlCall node, org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.rel.type.RelDataType targetRowType)
protected void
validateUnnest(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.rel.type.RelDataType targetRowType)
void
validateUnpivot(org.apache.calcite.sql.SqlUnpivot unpivot)
void
validateUpdate(org.apache.calcite.sql.SqlUpdate call)
protected void
validateValues(org.apache.calcite.sql.SqlCall node, org.apache.calcite.rel.type.RelDataType targetRowType, org.apache.calcite.sql.validate.SqlValidatorScope scope)
Validates a VALUES clause.protected void
validateWhereClause(org.apache.calcite.sql.SqlSelect select)
protected void
validateWhereOrOn(org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlNode condition, String clause)
void
validateWindow(org.apache.calcite.sql.SqlNode windowOrId, org.apache.calcite.sql.validate.SqlValidatorScope scope, @Nullable org.apache.calcite.sql.SqlCall call)
protected void
validateWindowClause(org.apache.calcite.sql.SqlSelect select)
void
validateWith(org.apache.calcite.sql.SqlWith with, org.apache.calcite.sql.validate.SqlValidatorScope scope)
void
validateWithItem(org.apache.calcite.sql.SqlWithItem withItem)
-
-
-
Field Detail
-
TRACER
public static final org.slf4j.Logger TRACER
-
UPDATE_SRC_ALIAS
public static final String UPDATE_SRC_ALIAS
Alias generated for the source table when rewriting UPDATE to MERGE.- See Also:
- Constant Field Values
-
UPDATE_TGT_ALIAS
public static final String UPDATE_TGT_ALIAS
Alias generated for the target table when rewriting UPDATE to MERGE if no alias was specified by the user.- See Also:
- Constant Field Values
-
UPDATE_ANON_PREFIX
public static final String UPDATE_ANON_PREFIX
Alias prefix generated for source columns when rewriting UPDATE to MERGE.- See Also:
- Constant Field Values
-
idPositions
protected final Map<String,SqlValidatorImpl.IdInfo> idPositions
MapsSqlParserPos
strings to theSqlIdentifier
identifier objects at these positions.
-
scopes
protected final IdentityHashMap<org.apache.calcite.sql.SqlNode,org.apache.calcite.sql.validate.SqlValidatorScope> scopes
Mapsquery node
objects to theSqlValidatorScope
scope created from them.
-
namespaces
protected final IdentityHashMap<org.apache.calcite.sql.SqlNode,org.apache.calcite.sql.validate.SqlValidatorNamespace> namespaces
Maps anode
to thenamespace
which describes what columns they contain.
-
functionCallStack
protected final Deque<SqlValidatorImpl.FunctionParamInfo> functionCallStack
Stack of objects that maintain information about function calls. A stack is needed to handle nested function calls. The function call currently being validated is at the top of the stack.
-
typeFactory
protected final org.apache.calcite.rel.type.RelDataTypeFactory typeFactory
-
unknownType
protected final org.apache.calcite.rel.type.RelDataType unknownType
The type of dynamic parameters until a type is imposed on them.
-
callToOperandTypesMap
public final IdentityHashMap<org.apache.calcite.sql.SqlCall,List<org.apache.calcite.rel.type.RelDataType>> callToOperandTypesMap
Provides the data forgetValidatedOperandTypes(SqlCall)
.
-
-
Constructor Detail
-
SqlValidatorImpl
protected SqlValidatorImpl(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)
Creates a validator.- Parameters:
opTab
- Operator tablecatalogReader
- Catalog readertypeFactory
- Type factoryconfig
- Config
-
-
Method Detail
-
getConformance
public org.apache.calcite.sql.validate.SqlConformance getConformance()
-
getCatalogReader
@Pure public org.apache.calcite.sql.validate.SqlValidatorCatalogReader getCatalogReader()
- Specified by:
getCatalogReader
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getOperatorTable
@Pure public org.apache.calcite.sql.SqlOperatorTable getOperatorTable()
- Specified by:
getOperatorTable
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getTypeFactory
@Pure public org.apache.calcite.rel.type.RelDataTypeFactory getTypeFactory()
- Specified by:
getTypeFactory
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getUnknownType
public org.apache.calcite.rel.type.RelDataType getUnknownType()
- Specified by:
getUnknownType
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
expandStar
public org.apache.calcite.sql.SqlNodeList expandStar(org.apache.calcite.sql.SqlNodeList selectList, org.apache.calcite.sql.SqlSelect select, boolean includeSystemVars)
- Specified by:
expandStar
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
declareCursor
public void declareCursor(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.validate.SqlValidatorScope parentScope)
- Specified by:
declareCursor
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
pushFunctionCall
public void pushFunctionCall()
- Specified by:
pushFunctionCall
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
popFunctionCall
public void popFunctionCall()
- Specified by:
popFunctionCall
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getParentCursor
public @Nullable String getParentCursor(String columnListParamName)
- Specified by:
getParentCursor
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
usingNames
public @Nullable List<String> usingNames(SqlJoin join)
Returns the set of field names in the join condition specified by USING or implicitly by NATURAL, de-duplicated and in order.
-
validate
public org.apache.calcite.sql.SqlNode validate(org.apache.calcite.sql.SqlNode topNode)
- Specified by:
validate
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
lookupHints
public List<org.apache.calcite.sql.validate.SqlMoniker> lookupHints(org.apache.calcite.sql.SqlNode topNode, org.apache.calcite.sql.parser.SqlParserPos pos)
- Specified by:
lookupHints
in interfaceorg.apache.calcite.sql.validate.SqlValidatorWithHints
-
lookupQualifiedName
public @Nullable org.apache.calcite.sql.validate.SqlMoniker lookupQualifiedName(org.apache.calcite.sql.SqlNode topNode, org.apache.calcite.sql.parser.SqlParserPos pos)
- Specified by:
lookupQualifiedName
in interfaceorg.apache.calcite.sql.validate.SqlValidatorWithHints
-
lookupNameCompletionHints
public final void lookupNameCompletionHints(org.apache.calcite.sql.validate.SqlValidatorScope scope, List<String> names, org.apache.calcite.sql.parser.SqlParserPos pos, Collection<org.apache.calcite.sql.validate.SqlMoniker> hintList)
Populates a list of all the valid alternatives for an identifier.- Parameters:
scope
- Validation scopenames
- Components of the identifierpos
- positionhintList
- a list of valid options
-
validateParameterizedExpression
public org.apache.calcite.sql.SqlNode validateParameterizedExpression(org.apache.calcite.sql.SqlNode topNode, Map<String,org.apache.calcite.rel.type.RelDataType> nameToTypeMap)
- Specified by:
validateParameterizedExpression
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateQuery
public void validateQuery(org.apache.calcite.sql.SqlNode node, @Nullable org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.rel.type.RelDataType targetRowType)
- Specified by:
validateQuery
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateNamespace
protected void validateNamespace(org.apache.calcite.sql.validate.SqlValidatorNamespace namespace, org.apache.calcite.rel.type.RelDataType targetRowType)
Validates a namespace.- Parameters:
namespace
- NamespacetargetRowType
- Desired row type, must not be null, may be the data type 'unknown'.
-
getEmptyScope
public org.apache.calcite.sql.validate.SqlValidatorScope getEmptyScope()
-
getCursorScope
public org.apache.calcite.sql.validate.SqlValidatorScope getCursorScope(org.apache.calcite.sql.SqlSelect select)
-
getWhereScope
public org.apache.calcite.sql.validate.SqlValidatorScope getWhereScope(org.apache.calcite.sql.SqlSelect select)
- Specified by:
getWhereScope
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getSelectScope
public org.apache.calcite.sql.validate.SqlValidatorScope getSelectScope(org.apache.calcite.sql.SqlSelect select)
- Specified by:
getSelectScope
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getRawSelectScope
public @Nullable org.apache.calcite.sql.validate.SelectScope getRawSelectScope(org.apache.calcite.sql.SqlSelect select)
- Specified by:
getRawSelectScope
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getHavingScope
public org.apache.calcite.sql.validate.SqlValidatorScope getHavingScope(org.apache.calcite.sql.SqlSelect select)
- Specified by:
getHavingScope
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getGroupScope
public org.apache.calcite.sql.validate.SqlValidatorScope getGroupScope(org.apache.calcite.sql.SqlSelect select)
- Specified by:
getGroupScope
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getFromScope
public @Nullable org.apache.calcite.sql.validate.SqlValidatorScope getFromScope(org.apache.calcite.sql.SqlSelect select)
- Specified by:
getFromScope
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getOrderScope
public org.apache.calcite.sql.validate.SqlValidatorScope getOrderScope(org.apache.calcite.sql.SqlSelect select)
- Specified by:
getOrderScope
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getMatchRecognizeScope
public org.apache.calcite.sql.validate.SqlValidatorScope getMatchRecognizeScope(org.apache.calcite.sql.SqlMatchRecognize node)
- Specified by:
getMatchRecognizeScope
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getJoinScope
public @Nullable org.apache.calcite.sql.validate.SqlValidatorScope getJoinScope(org.apache.calcite.sql.SqlNode node)
- Specified by:
getJoinScope
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getOverScope
public org.apache.calcite.sql.validate.SqlValidatorScope getOverScope(org.apache.calcite.sql.SqlNode node)
- Specified by:
getOverScope
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getNamespace
public @Nullable org.apache.calcite.sql.validate.SqlValidatorNamespace getNamespace(org.apache.calcite.sql.SqlNode node)
- Specified by:
getNamespace
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
performUnconditionalRewrites
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. 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.
- 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
-
getSelfJoinExprForUpdate
protected @Nullable org.apache.calcite.sql.SqlNode getSelfJoinExprForUpdate(org.apache.calcite.sql.SqlNode table, String alias)
Allows a subclass to provide information about how to convert an UPDATE into a MERGE via self-join. If this method returns null, then no such conversion takes place. Otherwise, this method should return a suitable unique identifier expression for the given table.- Parameters:
table
- identifier for table being updatedalias
- alias to use for qualifying columns in expression, or null for unqualified references; if this is equal to "SYS$SRC", then column references have been anonymized to "SYS$ANONx", where x is the 1-based column number.- Returns:
- expression for unique identifier, or null to prevent conversion
-
createSourceSelectForUpdate
protected org.apache.calcite.sql.SqlSelect createSourceSelectForUpdate(org.apache.calcite.sql.SqlUpdate call)
Creates the SELECT statement that putatively feeds rows into an UPDATE statement to be updated.- Parameters:
call
- Call to the UPDATE operator- Returns:
- select statement
-
createSourceSelectForDelete
protected org.apache.calcite.sql.SqlSelect createSourceSelectForDelete(org.apache.calcite.sql.SqlDelete call)
Creates the SELECT statement that putatively feeds rows into a DELETE statement to be deleted.- Parameters:
call
- Call to the DELETE operator- Returns:
- select statement
-
getValidatedNodeType
public org.apache.calcite.rel.type.RelDataType getValidatedNodeType(org.apache.calcite.sql.SqlNode node)
- Specified by:
getValidatedNodeType
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getValidatedNodeTypeIfKnown
public @Nullable org.apache.calcite.rel.type.RelDataType getValidatedNodeTypeIfKnown(org.apache.calcite.sql.SqlNode node)
- Specified by:
getValidatedNodeTypeIfKnown
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getValidatedOperandTypes
public @Nullable List<org.apache.calcite.rel.type.RelDataType> getValidatedOperandTypes(org.apache.calcite.sql.SqlCall call)
- Specified by:
getValidatedOperandTypes
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
setValidatedNodeType
public final void setValidatedNodeType(org.apache.calcite.sql.SqlNode node, org.apache.calcite.rel.type.RelDataType type)
Saves the type of aSqlNode
, now that it has been validated.Unlike the base class method, this method is not deprecated. It is available from within Calcite, but is not part of the public API.
- Specified by:
setValidatedNodeType
in interfaceorg.apache.calcite.sql.validate.SqlValidator
- Parameters:
node
- A SQL parse tree node, never nulltype
- Its type; must not be null
-
removeValidatedNodeType
public void removeValidatedNodeType(org.apache.calcite.sql.SqlNode node)
- Specified by:
removeValidatedNodeType
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
makeNullaryCall
public @Nullable org.apache.calcite.sql.SqlCall makeNullaryCall(org.apache.calcite.sql.SqlIdentifier id)
- Specified by:
makeNullaryCall
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
deriveType
public org.apache.calcite.rel.type.RelDataType deriveType(org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlNode expr)
- Specified by:
deriveType
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
deriveConstructorType
public org.apache.calcite.rel.type.RelDataType deriveConstructorType(org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.SqlFunction unresolvedConstructor, @Nullable org.apache.calcite.sql.SqlFunction resolvedConstructor, List<org.apache.calcite.rel.type.RelDataType> argTypes)
- Specified by:
deriveConstructorType
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
handleUnresolvedFunction
public org.apache.calcite.runtime.CalciteException handleUnresolvedFunction(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.SqlOperator unresolvedFunction, List<org.apache.calcite.rel.type.RelDataType> argTypes, @Nullable List<String> argNames)
- Specified by:
handleUnresolvedFunction
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
inferUnknownTypes
protected void inferUnknownTypes(org.apache.calcite.rel.type.RelDataType inferredType, org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlNode node)
-
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)
Adds an expression to a select list, ensuring that its alias does not clash with any existing expressions on the list.
-
deriveAlias
public @Nullable String deriveAlias(org.apache.calcite.sql.SqlNode node, int ordinal)
- Specified by:
deriveAlias
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
shouldAllowIntermediateOrderBy
protected boolean shouldAllowIntermediateOrderBy()
-
createMatchRecognizeNameSpace
protected org.apache.calcite.sql.validate.MatchRecognizeNamespace createMatchRecognizeNameSpace(org.apache.calcite.sql.SqlMatchRecognize call, org.apache.calcite.sql.SqlNode enclosingNode)
-
createPivotNameSpace
protected org.apache.calcite.sql.validate.PivotNamespace createPivotNameSpace(org.apache.calcite.sql.SqlPivot call, org.apache.calcite.sql.SqlNode enclosingNode)
-
createUnpivotNameSpace
protected org.apache.calcite.sql.validate.UnpivotNamespace createUnpivotNameSpace(org.apache.calcite.sql.SqlUnpivot call, org.apache.calcite.sql.SqlNode enclosingNode)
-
registerNamespace
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. Derived class can override this method to tinker with namespaces as they are created.- 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
-
shouldAllowOverRelation
protected boolean shouldAllowOverRelation()
-
createSelectNamespace
protected org.apache.calcite.sql.validate.SelectNamespace createSelectNamespace(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.SqlNode enclosingNode)
Creates a namespace for aSELECT
node. Derived class may override this factory method.- Parameters:
select
- Select nodeenclosingNode
- Enclosing node- Returns:
- Select namespace
-
createSetopNamespace
protected org.apache.calcite.sql.validate.SetopNamespace createSetopNamespace(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.SqlNode enclosingNode)
Creates a namespace for a set operation (UNION
,INTERSECT
, orEXCEPT
). Derived class may override this factory method.- Parameters:
call
- Call to set operationenclosingNode
- Enclosing node- Returns:
- Set operation namespace
-
isAggregate
public boolean isAggregate(org.apache.calcite.sql.SqlSelect select)
- Specified by:
isAggregate
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
isNestedAggregateWindow
protected boolean isNestedAggregateWindow(org.apache.calcite.sql.SqlNode node)
-
isOverAggregateWindow
protected boolean isOverAggregateWindow(org.apache.calcite.sql.SqlNode node)
-
getAggregate
protected @Nullable org.apache.calcite.sql.SqlNode getAggregate(org.apache.calcite.sql.SqlSelect select)
Returns the parse tree node (GROUP BY, HAVING, or an aggregate function call) that causesselect
to be an aggregate query, or null if it is not an aggregate query.The node is useful context for error messages, but you cannot assume that the node is the only aggregate function.
-
isAggregate
@Deprecated public boolean isAggregate(org.apache.calcite.sql.SqlNode selectNode)
Deprecated.- Specified by:
isAggregate
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateIdentifier
public void validateIdentifier(org.apache.calcite.sql.SqlIdentifier id, org.apache.calcite.sql.validate.SqlValidatorScope scope)
- Specified by:
validateIdentifier
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateLiteral
public void validateLiteral(org.apache.calcite.sql.SqlLiteral literal)
- Specified by:
validateLiteral
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateIntervalQualifier
public void validateIntervalQualifier(org.apache.calcite.sql.SqlIntervalQualifier qualifier)
- Specified by:
validateIntervalQualifier
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateFrom
protected void validateFrom(org.apache.calcite.sql.SqlNode node, org.apache.calcite.rel.type.RelDataType targetRowType, org.apache.calcite.sql.validate.SqlValidatorScope scope)
Validates the FROM clause of a query, or (recursively) a child node of the FROM clause: AS, OVER, JOIN, VALUES, or sub-query.- Parameters:
node
- Node in FROM clause, typically a table or derived tabletargetRowType
- Desired row type of this expression, orunknownType
if not fussy. Must not be null.scope
- Scope
-
validateTableFunction
protected void validateTableFunction(org.apache.calcite.sql.SqlCall node, org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.rel.type.RelDataType targetRowType)
-
validateOver
protected void validateOver(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidatorScope scope)
-
validateUnnest
protected void validateUnnest(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.rel.type.RelDataType targetRowType)
-
validateJoin
protected void validateJoin(SqlJoin join, org.apache.calcite.sql.validate.SqlValidatorScope scope)
-
validateSelect
protected void validateSelect(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.rel.type.RelDataType targetRowType)
Validates a SELECT statement.- Parameters:
select
- Select statementtargetRowType
- Desired row type, must not be null, may be the data type 'unknown'.
-
validateModality
public boolean validateModality(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.validate.SqlModality modality, boolean fail)
- Specified by:
validateModality
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateWindowClause
protected void validateWindowClause(org.apache.calcite.sql.SqlSelect select)
-
validateWith
public void validateWith(org.apache.calcite.sql.SqlWith with, org.apache.calcite.sql.validate.SqlValidatorScope scope)
- Specified by:
validateWith
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateWithItem
public void validateWithItem(org.apache.calcite.sql.SqlWithItem withItem)
- Specified by:
validateWithItem
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateSequenceValue
public void validateSequenceValue(org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlIdentifier id)
- Specified by:
validateSequenceValue
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getWithScope
public @Nullable org.apache.calcite.sql.validate.SqlValidatorScope getWithScope(org.apache.calcite.sql.SqlNode withItem)
- Specified by:
getWithScope
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getTypeCoercion
public org.apache.calcite.sql.validate.implicit.TypeCoercion getTypeCoercion()
- Specified by:
getTypeCoercion
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
config
public org.apache.calcite.sql.validate.SqlValidator.Config config()
- Specified by:
config
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
transform
public org.apache.calcite.sql.validate.SqlValidator transform(UnaryOperator<org.apache.calcite.sql.validate.SqlValidator.Config> transform)
- Specified by:
transform
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateOrderList
protected void validateOrderList(org.apache.calcite.sql.SqlSelect select)
Validates the ORDER BY clause of a SELECT statement.- Parameters:
select
- Select statement
-
expandOrderExpr
public org.apache.calcite.sql.SqlNode expandOrderExpr(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.SqlNode orderExpr)
- Specified by:
expandOrderExpr
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateGroupClause
protected void validateGroupClause(org.apache.calcite.sql.SqlSelect select)
Validates the GROUP BY clause of a SELECT statement. This method is called even if no GROUP BY clause is present.
-
validateWhereClause
protected void validateWhereClause(org.apache.calcite.sql.SqlSelect select)
-
validateWhereOrOn
protected void validateWhereOrOn(org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlNode condition, String clause)
-
validateHavingClause
protected void validateHavingClause(org.apache.calcite.sql.SqlSelect select)
-
validateSelectList
protected org.apache.calcite.rel.type.RelDataType validateSelectList(org.apache.calcite.sql.SqlNodeList selectItems, org.apache.calcite.sql.SqlSelect select, org.apache.calcite.rel.type.RelDataType targetRowType)
-
createTargetRowType
protected org.apache.calcite.rel.type.RelDataType createTargetRowType(org.apache.calcite.sql.validate.SqlValidatorTable table, @Nullable org.apache.calcite.sql.SqlNodeList targetColumnList, boolean append)
Derives a row-type for INSERT and UPDATE operations.- Parameters:
table
- Target table for INSERT/UPDATEtargetColumnList
- List of target columns, or null if not specifiedappend
- Whether to append fields to those inbaseRowType
- Returns:
- Rowtype
-
validateInsert
public void validateInsert(org.apache.calcite.sql.SqlInsert insert)
- Specified by:
validateInsert
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getLogicalTargetRowType
protected org.apache.calcite.rel.type.RelDataType getLogicalTargetRowType(org.apache.calcite.rel.type.RelDataType targetRowType, org.apache.calcite.sql.SqlInsert insert)
-
getLogicalSourceRowType
protected org.apache.calcite.rel.type.RelDataType getLogicalSourceRowType(org.apache.calcite.rel.type.RelDataType sourceRowType, org.apache.calcite.sql.SqlInsert insert)
-
checkTypeAssignment
protected void checkTypeAssignment(@Nullable org.apache.calcite.sql.validate.SqlValidatorScope sourceScope, org.apache.calcite.sql.validate.SqlValidatorTable table, org.apache.calcite.rel.type.RelDataType sourceRowType, org.apache.calcite.rel.type.RelDataType targetRowType, org.apache.calcite.sql.SqlNode query)
Checks the type assignment of an INSERT or UPDATE query.Skip the virtual columns(can not insert into) type assignment check if the source fields count equals with the real target table fields count, see how #checkFieldCount was used.
- Parameters:
sourceScope
- Scope of query source which is used to infer node typetable
- Target tablesourceRowType
- Source row typetargetRowType
- Target row type, it should either contain all the virtual columns (can not insert into) or exclude all the virtual columnsquery
- The query
-
validateDelete
public void validateDelete(org.apache.calcite.sql.SqlDelete call)
- Specified by:
validateDelete
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateUpdate
public void validateUpdate(org.apache.calcite.sql.SqlUpdate call)
- Specified by:
validateUpdate
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateMerge
public void validateMerge(org.apache.calcite.sql.SqlMerge call)
- Specified by:
validateMerge
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateValues
protected void validateValues(org.apache.calcite.sql.SqlCall node, org.apache.calcite.rel.type.RelDataType targetRowType, org.apache.calcite.sql.validate.SqlValidatorScope scope)
Validates a VALUES clause.- Parameters:
node
- Values clausetargetRowType
- Row type which expression must conform toscope
- Scope within which clause occurs
-
validateDataType
public void validateDataType(org.apache.calcite.sql.SqlDataTypeSpec dataType)
- Specified by:
validateDataType
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateDynamicParam
public void validateDynamicParam(org.apache.calcite.sql.SqlDynamicParam dynamicParam)
- Specified by:
validateDynamicParam
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getValidationErrorFunction
public org.apache.calcite.sql.validate.SqlValidatorImpl.ValidationErrorFunction getValidationErrorFunction()
-
newValidationError
public org.apache.calcite.runtime.CalciteContextException newValidationError(org.apache.calcite.sql.SqlNode node, org.apache.calcite.runtime.Resources.ExInst<org.apache.calcite.sql.validate.SqlValidatorException> e)
- Specified by:
newValidationError
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getWindowByName
protected org.apache.calcite.sql.SqlWindow getWindowByName(org.apache.calcite.sql.SqlIdentifier id, org.apache.calcite.sql.validate.SqlValidatorScope scope)
-
resolveWindow
public org.apache.calcite.sql.SqlWindow resolveWindow(org.apache.calcite.sql.SqlNode windowOrRef, org.apache.calcite.sql.validate.SqlValidatorScope scope)
- Specified by:
resolveWindow
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getOriginal
public org.apache.calcite.sql.SqlNode getOriginal(org.apache.calcite.sql.SqlNode expr)
-
setOriginal
public void setOriginal(org.apache.calcite.sql.SqlNode expr, org.apache.calcite.sql.SqlNode original)
-
validateWindow
public void validateWindow(org.apache.calcite.sql.SqlNode windowOrId, org.apache.calcite.sql.validate.SqlValidatorScope scope, @Nullable org.apache.calcite.sql.SqlCall call)
- Specified by:
validateWindow
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateMatchRecognize
public void validateMatchRecognize(org.apache.calcite.sql.SqlCall call)
- Specified by:
validateMatchRecognize
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validatePivot
public void validatePivot(org.apache.calcite.sql.SqlPivot pivot)
-
validateUnpivot
public void validateUnpivot(org.apache.calcite.sql.SqlUnpivot unpivot)
-
validateAggregateParams
public void validateAggregateParams(org.apache.calcite.sql.SqlCall aggCall, @Nullable org.apache.calcite.sql.SqlNode filter, @Nullable org.apache.calcite.sql.SqlNodeList distinctList, @Nullable org.apache.calcite.sql.SqlNodeList orderList, org.apache.calcite.sql.validate.SqlValidatorScope scope)
- Specified by:
validateAggregateParams
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateCall
public void validateCall(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidatorScope scope)
- Specified by:
validateCall
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
validateFeature
protected void validateFeature(org.apache.calcite.runtime.Feature feature, org.apache.calcite.sql.parser.SqlParserPos context)
Validates that a particular feature is enabled. By default, all features are enabled; subclasses may override this method to be more discriminating.- Parameters:
feature
- feature being used, represented as a resource instancecontext
- parser position context for error reporting, or null if
-
expandSelectExpr
public org.apache.calcite.sql.SqlNode expandSelectExpr(org.apache.calcite.sql.SqlNode expr, org.apache.calcite.sql.validate.SelectScope scope, org.apache.calcite.sql.SqlSelect select)
-
expand
public org.apache.calcite.sql.SqlNode expand(org.apache.calcite.sql.SqlNode expr, org.apache.calcite.sql.validate.SqlValidatorScope scope)
- Specified by:
expand
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
expandGroupByOrHavingExpr
public org.apache.calcite.sql.SqlNode expandGroupByOrHavingExpr(org.apache.calcite.sql.SqlNode expr, org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlSelect select, boolean havingExpression)
-
isSystemField
public boolean isSystemField(org.apache.calcite.rel.type.RelDataTypeField field)
- Specified by:
isSystemField
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getFieldOrigins
public List<@Nullable List<String>> getFieldOrigins(org.apache.calcite.sql.SqlNode sqlQuery)
- Specified by:
getFieldOrigins
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
getParameterRowType
public org.apache.calcite.rel.type.RelDataType getParameterRowType(org.apache.calcite.sql.SqlNode sqlQuery)
- Specified by:
getParameterRowType
in interfaceorg.apache.calcite.sql.validate.SqlValidator
-
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
-
-