public class SqlValidatorImpl extends Object implements org.apache.calcite.sql.validate.SqlValidatorWithHints
SqlValidator, the class was copied over because of
CALCITE-4554.
Lines 1958 ~ 1978, 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 3736 ~ 3740, Flink improves Optimize the retrieval of sub-operands in SqlCall when using
NamedParameters at checkRollUp(org.apache.calcite.sql.SqlNode, org.apache.calcite.sql.SqlNode, org.apache.calcite.sql.SqlNode, org.apache.calcite.sql.validate.SqlValidatorScope, java.lang.String).
Lines 5108 ~ 5121, 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 5465 ~ 5471, Flink enables TIMESTAMP and TIMESTAMP_LTZ for first orderBy column in
matchRecognize at validateMatchRecognize(org.apache.calcite.sql.SqlCall).
| Modifier and Type | Class and 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.
|
| Modifier and Type | Field and Description |
|---|---|
IdentityHashMap<org.apache.calcite.sql.SqlCall,List<org.apache.calcite.rel.type.RelDataType>> |
callToOperandTypesMap
Provides the data for
getValidatedOperandTypes(SqlCall). |
protected Deque<SqlValidatorImpl.FunctionParamInfo> |
functionCallStack
Stack of objects that maintain information about function calls.
|
protected Map<String,SqlValidatorImpl.IdInfo> |
idPositions
Maps
SqlParserPos strings to the SqlIdentifier identifier objects at these
positions. |
protected IdentityHashMap<org.apache.calcite.sql.SqlNode,org.apache.calcite.sql.validate.SqlValidatorNamespace> |
namespaces
Maps a
node to the namespace which describes
what columns they contain. |
protected IdentityHashMap<org.apache.calcite.sql.SqlNode,org.apache.calcite.sql.validate.SqlValidatorScope> |
scopes
Maps
query node objects to the SqlValidatorScope 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.
|
| Modifier | Constructor and 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.
|
| Modifier and Type | Method and 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 a
SELECT 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, or EXCEPT). |
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 causes
select 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<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 a
SqlNode, 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(org.apache.calcite.sql.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(org.apache.calcite.sql.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) |
public static final org.slf4j.Logger TRACER
public static final String UPDATE_SRC_ALIAS
public static final String UPDATE_TGT_ALIAS
public static final String UPDATE_ANON_PREFIX
protected final Map<String,SqlValidatorImpl.IdInfo> idPositions
SqlParserPos strings to the SqlIdentifier identifier objects at these
positions.protected final IdentityHashMap<org.apache.calcite.sql.SqlNode,org.apache.calcite.sql.validate.SqlValidatorScope> scopes
query node objects to the SqlValidatorScope scope created from
them.protected final IdentityHashMap<org.apache.calcite.sql.SqlNode,org.apache.calcite.sql.validate.SqlValidatorNamespace> namespaces
node to the namespace which describes
what columns they contain.protected final Deque<SqlValidatorImpl.FunctionParamInfo> functionCallStack
protected final org.apache.calcite.rel.type.RelDataTypeFactory typeFactory
protected final org.apache.calcite.rel.type.RelDataType unknownType
public final IdentityHashMap<org.apache.calcite.sql.SqlCall,List<org.apache.calcite.rel.type.RelDataType>> callToOperandTypesMap
getValidatedOperandTypes(SqlCall).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)
opTab - Operator tablecatalogReader - Catalog readertypeFactory - Type factoryconfig - Configpublic org.apache.calcite.sql.validate.SqlConformance getConformance()
@Pure public org.apache.calcite.sql.validate.SqlValidatorCatalogReader getCatalogReader()
getCatalogReader in interface org.apache.calcite.sql.validate.SqlValidator@Pure public org.apache.calcite.sql.SqlOperatorTable getOperatorTable()
getOperatorTable in interface org.apache.calcite.sql.validate.SqlValidator@Pure public org.apache.calcite.rel.type.RelDataTypeFactory getTypeFactory()
getTypeFactory in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.rel.type.RelDataType getUnknownType()
getUnknownType in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.SqlNodeList expandStar(org.apache.calcite.sql.SqlNodeList selectList,
org.apache.calcite.sql.SqlSelect select,
boolean includeSystemVars)
expandStar in interface org.apache.calcite.sql.validate.SqlValidatorpublic void declareCursor(org.apache.calcite.sql.SqlSelect select,
org.apache.calcite.sql.validate.SqlValidatorScope parentScope)
declareCursor in interface org.apache.calcite.sql.validate.SqlValidatorpublic void pushFunctionCall()
pushFunctionCall in interface org.apache.calcite.sql.validate.SqlValidatorpublic void popFunctionCall()
popFunctionCall in interface org.apache.calcite.sql.validate.SqlValidatorpublic @Nullable String getParentCursor(String columnListParamName)
getParentCursor in interface org.apache.calcite.sql.validate.SqlValidatorpublic @Nullable List<String> usingNames(org.apache.calcite.sql.SqlJoin join)
public org.apache.calcite.sql.SqlNode validate(org.apache.calcite.sql.SqlNode topNode)
validate in interface org.apache.calcite.sql.validate.SqlValidatorpublic List<org.apache.calcite.sql.validate.SqlMoniker> lookupHints(org.apache.calcite.sql.SqlNode topNode, org.apache.calcite.sql.parser.SqlParserPos pos)
lookupHints in interface org.apache.calcite.sql.validate.SqlValidatorWithHintspublic @Nullable org.apache.calcite.sql.validate.SqlMoniker lookupQualifiedName(org.apache.calcite.sql.SqlNode topNode,
org.apache.calcite.sql.parser.SqlParserPos pos)
lookupQualifiedName in interface org.apache.calcite.sql.validate.SqlValidatorWithHintspublic 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)
scope - Validation scopenames - Components of the identifierpos - positionhintList - a list of valid optionspublic org.apache.calcite.sql.SqlNode validateParameterizedExpression(org.apache.calcite.sql.SqlNode topNode,
Map<String,org.apache.calcite.rel.type.RelDataType> nameToTypeMap)
validateParameterizedExpression in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateQuery(org.apache.calcite.sql.SqlNode node,
@Nullable org.apache.calcite.sql.validate.SqlValidatorScope scope,
org.apache.calcite.rel.type.RelDataType targetRowType)
validateQuery in interface org.apache.calcite.sql.validate.SqlValidatorprotected void validateNamespace(org.apache.calcite.sql.validate.SqlValidatorNamespace namespace,
org.apache.calcite.rel.type.RelDataType targetRowType)
namespace - NamespacetargetRowType - Desired row type, must not be null, may be the data type 'unknown'.public org.apache.calcite.sql.validate.SqlValidatorScope getEmptyScope()
public org.apache.calcite.sql.validate.SqlValidatorScope getCursorScope(org.apache.calcite.sql.SqlSelect select)
public org.apache.calcite.sql.validate.SqlValidatorScope getWhereScope(org.apache.calcite.sql.SqlSelect select)
getWhereScope in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.validate.SqlValidatorScope getSelectScope(org.apache.calcite.sql.SqlSelect select)
getSelectScope in interface org.apache.calcite.sql.validate.SqlValidatorpublic @Nullable org.apache.calcite.sql.validate.SelectScope getRawSelectScope(org.apache.calcite.sql.SqlSelect select)
getRawSelectScope in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.validate.SqlValidatorScope getHavingScope(org.apache.calcite.sql.SqlSelect select)
getHavingScope in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.validate.SqlValidatorScope getGroupScope(org.apache.calcite.sql.SqlSelect select)
getGroupScope in interface org.apache.calcite.sql.validate.SqlValidatorpublic @Nullable org.apache.calcite.sql.validate.SqlValidatorScope getFromScope(org.apache.calcite.sql.SqlSelect select)
getFromScope in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.validate.SqlValidatorScope getOrderScope(org.apache.calcite.sql.SqlSelect select)
getOrderScope in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.validate.SqlValidatorScope getMatchRecognizeScope(org.apache.calcite.sql.SqlMatchRecognize node)
getMatchRecognizeScope in interface org.apache.calcite.sql.validate.SqlValidatorpublic @Nullable org.apache.calcite.sql.validate.SqlValidatorScope getJoinScope(org.apache.calcite.sql.SqlNode node)
getJoinScope in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.validate.SqlValidatorScope getOverScope(org.apache.calcite.sql.SqlNode node)
getOverScope in interface org.apache.calcite.sql.validate.SqlValidatorpublic @Nullable org.apache.calcite.sql.validate.SqlValidatorNamespace getNamespace(org.apache.calcite.sql.SqlNode node)
getNamespace in interface org.apache.calcite.sql.validate.SqlValidatorprotected @PolyNull org.apache.calcite.sql.SqlNode performUnconditionalRewrites(@PolyNull org.apache.calcite.sql.SqlNode node,
boolean underFrom)
Returns null if and only if the original expression is null.
node - expression to be rewrittenunderFrom - whether node appears directly under a FROM clauseprotected @Nullable org.apache.calcite.sql.SqlNode getSelfJoinExprForUpdate(org.apache.calcite.sql.SqlNode table,
String alias)
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.protected org.apache.calcite.sql.SqlSelect createSourceSelectForUpdate(org.apache.calcite.sql.SqlUpdate call)
call - Call to the UPDATE operatorprotected org.apache.calcite.sql.SqlSelect createSourceSelectForDelete(org.apache.calcite.sql.SqlDelete call)
call - Call to the DELETE operatorpublic org.apache.calcite.rel.type.RelDataType getValidatedNodeType(org.apache.calcite.sql.SqlNode node)
getValidatedNodeType in interface org.apache.calcite.sql.validate.SqlValidatorpublic @Nullable org.apache.calcite.rel.type.RelDataType getValidatedNodeTypeIfKnown(org.apache.calcite.sql.SqlNode node)
getValidatedNodeTypeIfKnown in interface org.apache.calcite.sql.validate.SqlValidatorpublic @Nullable List<org.apache.calcite.rel.type.RelDataType> getValidatedOperandTypes(org.apache.calcite.sql.SqlCall call)
getValidatedOperandTypes in interface org.apache.calcite.sql.validate.SqlValidatorpublic final void setValidatedNodeType(org.apache.calcite.sql.SqlNode node,
org.apache.calcite.rel.type.RelDataType type)
SqlNode, 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.
setValidatedNodeType in interface org.apache.calcite.sql.validate.SqlValidatornode - A SQL parse tree node, never nulltype - Its type; must not be nullpublic void removeValidatedNodeType(org.apache.calcite.sql.SqlNode node)
removeValidatedNodeType in interface org.apache.calcite.sql.validate.SqlValidatorpublic @Nullable org.apache.calcite.sql.SqlCall makeNullaryCall(org.apache.calcite.sql.SqlIdentifier id)
makeNullaryCall in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.rel.type.RelDataType deriveType(org.apache.calcite.sql.validate.SqlValidatorScope scope,
org.apache.calcite.sql.SqlNode expr)
deriveType in interface org.apache.calcite.sql.validate.SqlValidatorpublic 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)
deriveConstructorType in interface org.apache.calcite.sql.validate.SqlValidatorpublic 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)
handleUnresolvedFunction in interface org.apache.calcite.sql.validate.SqlValidatorprotected void inferUnknownTypes(org.apache.calcite.rel.type.RelDataType inferredType,
org.apache.calcite.sql.validate.SqlValidatorScope scope,
org.apache.calcite.sql.SqlNode node)
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)
public @Nullable String deriveAlias(org.apache.calcite.sql.SqlNode node, int ordinal)
deriveAlias in interface org.apache.calcite.sql.validate.SqlValidatorprotected boolean shouldAllowIntermediateOrderBy()
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.UnpivotNamespace createUnpivotNameSpace(org.apache.calcite.sql.SqlUnpivot call,
org.apache.calcite.sql.SqlNode enclosingNode)
protected void registerNamespace(@Nullable org.apache.calcite.sql.validate.SqlValidatorScope usingScope,
@Nullable String alias,
org.apache.calcite.sql.validate.SqlValidatorNamespace ns,
boolean forceNullable)
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 nullableprotected boolean shouldAllowOverRelation()
protected org.apache.calcite.sql.validate.SelectNamespace createSelectNamespace(org.apache.calcite.sql.SqlSelect select,
org.apache.calcite.sql.SqlNode enclosingNode)
SELECT node. Derived class may override this factory
method.select - Select nodeenclosingNode - Enclosing nodeprotected org.apache.calcite.sql.validate.SetopNamespace createSetopNamespace(org.apache.calcite.sql.SqlCall call,
org.apache.calcite.sql.SqlNode enclosingNode)
UNION,
INTERSECT, or EXCEPT). Derived class may override this factory method.call - Call to set operationenclosingNode - Enclosing nodepublic boolean isAggregate(org.apache.calcite.sql.SqlSelect select)
isAggregate in interface org.apache.calcite.sql.validate.SqlValidatorprotected boolean isNestedAggregateWindow(org.apache.calcite.sql.SqlNode node)
protected boolean isOverAggregateWindow(org.apache.calcite.sql.SqlNode node)
protected @Nullable org.apache.calcite.sql.SqlNode getAggregate(org.apache.calcite.sql.SqlSelect select)
select 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.
@Deprecated public boolean isAggregate(org.apache.calcite.sql.SqlNode selectNode)
isAggregate in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateIdentifier(org.apache.calcite.sql.SqlIdentifier id,
org.apache.calcite.sql.validate.SqlValidatorScope scope)
validateIdentifier in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateLiteral(org.apache.calcite.sql.SqlLiteral literal)
validateLiteral in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateIntervalQualifier(org.apache.calcite.sql.SqlIntervalQualifier qualifier)
validateIntervalQualifier in interface org.apache.calcite.sql.validate.SqlValidatorprotected void validateFrom(org.apache.calcite.sql.SqlNode node,
org.apache.calcite.rel.type.RelDataType targetRowType,
org.apache.calcite.sql.validate.SqlValidatorScope scope)
node - Node in FROM clause, typically a table or derived tabletargetRowType - Desired row type of this expression, or unknownType if not
fussy. Must not be null.scope - Scopeprotected void validateTableFunction(org.apache.calcite.sql.SqlCall node,
org.apache.calcite.sql.validate.SqlValidatorScope scope,
org.apache.calcite.rel.type.RelDataType targetRowType)
protected void validateOver(org.apache.calcite.sql.SqlCall call,
org.apache.calcite.sql.validate.SqlValidatorScope scope)
protected void validateUnnest(org.apache.calcite.sql.SqlCall call,
org.apache.calcite.sql.validate.SqlValidatorScope scope,
org.apache.calcite.rel.type.RelDataType targetRowType)
protected void validateJoin(org.apache.calcite.sql.SqlJoin join,
org.apache.calcite.sql.validate.SqlValidatorScope scope)
protected void validateSelect(org.apache.calcite.sql.SqlSelect select,
org.apache.calcite.rel.type.RelDataType targetRowType)
select - Select statementtargetRowType - Desired row type, must not be null, may be the data type 'unknown'.public boolean validateModality(org.apache.calcite.sql.SqlSelect select,
org.apache.calcite.sql.validate.SqlModality modality,
boolean fail)
validateModality in interface org.apache.calcite.sql.validate.SqlValidatorprotected void validateWindowClause(org.apache.calcite.sql.SqlSelect select)
public void validateWith(org.apache.calcite.sql.SqlWith with,
org.apache.calcite.sql.validate.SqlValidatorScope scope)
validateWith in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateWithItem(org.apache.calcite.sql.SqlWithItem withItem)
validateWithItem in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateSequenceValue(org.apache.calcite.sql.validate.SqlValidatorScope scope,
org.apache.calcite.sql.SqlIdentifier id)
validateSequenceValue in interface org.apache.calcite.sql.validate.SqlValidatorpublic @Nullable org.apache.calcite.sql.validate.SqlValidatorScope getWithScope(org.apache.calcite.sql.SqlNode withItem)
getWithScope in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.validate.implicit.TypeCoercion getTypeCoercion()
getTypeCoercion in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.validate.SqlValidator.Config config()
config in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.validate.SqlValidator transform(UnaryOperator<org.apache.calcite.sql.validate.SqlValidator.Config> transform)
transform in interface org.apache.calcite.sql.validate.SqlValidatorprotected void validateOrderList(org.apache.calcite.sql.SqlSelect select)
select - Select statementpublic org.apache.calcite.sql.SqlNode expandOrderExpr(org.apache.calcite.sql.SqlSelect select,
org.apache.calcite.sql.SqlNode orderExpr)
expandOrderExpr in interface org.apache.calcite.sql.validate.SqlValidatorprotected void validateGroupClause(org.apache.calcite.sql.SqlSelect select)
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)
protected void validateHavingClause(org.apache.calcite.sql.SqlSelect select)
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)
protected org.apache.calcite.rel.type.RelDataType createTargetRowType(org.apache.calcite.sql.validate.SqlValidatorTable table,
@Nullable org.apache.calcite.sql.SqlNodeList targetColumnList,
boolean append)
table - Target table for INSERT/UPDATEtargetColumnList - List of target columns, or null if not specifiedappend - Whether to append fields to those in
baseRowTypepublic void validateInsert(org.apache.calcite.sql.SqlInsert insert)
validateInsert in interface org.apache.calcite.sql.validate.SqlValidatorprotected org.apache.calcite.rel.type.RelDataType getLogicalTargetRowType(org.apache.calcite.rel.type.RelDataType targetRowType,
org.apache.calcite.sql.SqlInsert insert)
protected org.apache.calcite.rel.type.RelDataType getLogicalSourceRowType(org.apache.calcite.rel.type.RelDataType sourceRowType,
org.apache.calcite.sql.SqlInsert insert)
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)
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.
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 querypublic void validateDelete(org.apache.calcite.sql.SqlDelete call)
validateDelete in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateUpdate(org.apache.calcite.sql.SqlUpdate call)
validateUpdate in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateMerge(org.apache.calcite.sql.SqlMerge call)
validateMerge in interface org.apache.calcite.sql.validate.SqlValidatorprotected void validateValues(org.apache.calcite.sql.SqlCall node,
org.apache.calcite.rel.type.RelDataType targetRowType,
org.apache.calcite.sql.validate.SqlValidatorScope scope)
node - Values clausetargetRowType - Row type which expression must conform toscope - Scope within which clause occurspublic void validateDataType(org.apache.calcite.sql.SqlDataTypeSpec dataType)
validateDataType in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateDynamicParam(org.apache.calcite.sql.SqlDynamicParam dynamicParam)
validateDynamicParam in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.validate.SqlValidatorImpl.ValidationErrorFunction getValidationErrorFunction()
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)
newValidationError in interface org.apache.calcite.sql.validate.SqlValidatorprotected org.apache.calcite.sql.SqlWindow getWindowByName(org.apache.calcite.sql.SqlIdentifier id,
org.apache.calcite.sql.validate.SqlValidatorScope scope)
public org.apache.calcite.sql.SqlWindow resolveWindow(org.apache.calcite.sql.SqlNode windowOrRef,
org.apache.calcite.sql.validate.SqlValidatorScope scope)
resolveWindow in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.sql.SqlNode getOriginal(org.apache.calcite.sql.SqlNode expr)
public void setOriginal(org.apache.calcite.sql.SqlNode expr,
org.apache.calcite.sql.SqlNode original)
public void validateWindow(org.apache.calcite.sql.SqlNode windowOrId,
org.apache.calcite.sql.validate.SqlValidatorScope scope,
@Nullable org.apache.calcite.sql.SqlCall call)
validateWindow in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateMatchRecognize(org.apache.calcite.sql.SqlCall call)
validateMatchRecognize in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validatePivot(org.apache.calcite.sql.SqlPivot pivot)
public void validateUnpivot(org.apache.calcite.sql.SqlUnpivot unpivot)
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)
validateAggregateParams in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateCall(org.apache.calcite.sql.SqlCall call,
org.apache.calcite.sql.validate.SqlValidatorScope scope)
validateCall in interface org.apache.calcite.sql.validate.SqlValidatorprotected void validateFeature(org.apache.calcite.runtime.Feature feature,
org.apache.calcite.sql.parser.SqlParserPos context)
feature - feature being used, represented as a resource instancecontext - parser position context for error reporting, or null ifpublic 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)
public org.apache.calcite.sql.SqlNode expand(org.apache.calcite.sql.SqlNode expr,
org.apache.calcite.sql.validate.SqlValidatorScope scope)
expand in interface org.apache.calcite.sql.validate.SqlValidatorpublic 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)
public boolean isSystemField(org.apache.calcite.rel.type.RelDataTypeField field)
isSystemField in interface org.apache.calcite.sql.validate.SqlValidatorpublic List<List<String>> getFieldOrigins(org.apache.calcite.sql.SqlNode sqlQuery)
getFieldOrigins in interface org.apache.calcite.sql.validate.SqlValidatorpublic org.apache.calcite.rel.type.RelDataType getParameterRowType(org.apache.calcite.sql.SqlNode sqlQuery)
getParameterRowType in interface org.apache.calcite.sql.validate.SqlValidatorpublic void validateColumnListParams(org.apache.calcite.sql.SqlFunction function,
List<org.apache.calcite.rel.type.RelDataType> argTypes,
List<org.apache.calcite.sql.SqlNode> operands)
validateColumnListParams in interface org.apache.calcite.sql.validate.SqlValidatorCopyright © 2014–2025 The Apache Software Foundation. All rights reserved.