public class SqlValidatorImpl extends Object implements org.apache.calcite.sql.validate.SqlValidatorWithHints
SqlValidator
.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 |
---|---|
protected boolean |
expandColumnReferences |
protected boolean |
expandIdentifiers |
protected Deque<SqlValidatorImpl.FunctionParamInfo> |
functionCallStack
Stack of objects that maintain information about function calls.
|
protected Map<String,SqlValidatorImpl.IdInfo> |
idPositions
Maps ParsePosition strings to the
SqlIdentifier identifier
objects at these positions |
protected Map<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 Map<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.SqlConformance conformance)
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.SqlValidatorScope 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(org.apache.calcite.rel.type.RelDataType sourceRowType,
org.apache.calcite.rel.type.RelDataType targetRowType,
org.apache.calcite.sql.SqlNode query) |
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.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,
org.apache.calcite.sql.SqlNodeList targetColumnList,
boolean append)
Derives a row-type for INSERT and UPDATE operations.
|
void |
declareCursor(org.apache.calcite.sql.SqlSelect select,
org.apache.calcite.sql.validate.SqlValidatorScope parentScope) |
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,
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.SqlNodeList |
expandStar(org.apache.calcite.sql.SqlNodeList selectList,
org.apache.calcite.sql.SqlSelect select,
boolean includeSystemVars) |
protected 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() |
boolean |
getColumnReferenceExpansion() |
org.apache.calcite.sql.validate.SqlConformance |
getConformance() |
org.apache.calcite.sql.validate.SqlValidatorScope |
getCursorScope(org.apache.calcite.sql.SqlSelect select) |
org.apache.calcite.config.NullCollation |
getDefaultNullCollation() |
org.apache.calcite.sql.validate.SqlValidatorScope |
getEmptyScope() |
List<List<String>> |
getFieldOrigins(org.apache.calcite.sql.SqlNode sqlQuery) |
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) |
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) |
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) |
String |
getParentCursor(String columnListParamName) |
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 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.rel.type.RelDataTypeFactory |
getTypeFactory() |
org.apache.calcite.rel.type.RelDataType |
getUnknownType() |
org.apache.calcite.rel.type.RelDataType |
getValidatedNodeType(org.apache.calcite.sql.SqlNode node) |
org.apache.calcite.rel.type.RelDataType |
getValidatedNodeTypeIfKnown(org.apache.calcite.sql.SqlNode node) |
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) |
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.SqlFunction unresolvedFunction,
List<org.apache.calcite.rel.type.RelDataType> argTypes,
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) |
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.
|
org.apache.calcite.sql.validate.SqlMoniker |
lookupQualifiedName(org.apache.calcite.sql.SqlNode topNode,
org.apache.calcite.sql.parser.SqlParserPos pos) |
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 org.apache.calcite.sql.SqlNode |
performUnconditionalRewrites(org.apache.calcite.sql.SqlNode node,
boolean underFrom)
Performs expression rewrites which are always used unconditionally.
|
void |
popFunctionCall() |
void |
pushFunctionCall() |
protected void |
registerNamespace(org.apache.calcite.sql.validate.SqlValidatorScope usingScope,
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,
boolean populateBounds) |
void |
setCallRewrite(boolean rewriteCalls) |
void |
setColumnReferenceExpansion(boolean expandColumnReferences) |
void |
setDefaultNullCollation(org.apache.calcite.config.NullCollation nullCollation) |
void |
setIdentifierExpansion(boolean expandIdentifiers) |
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() |
boolean |
shouldExpandIdentifiers() |
org.apache.calcite.sql.SqlNode |
validate(org.apache.calcite.sql.SqlNode topNode) |
void |
validateAggregateParams(org.apache.calcite.sql.SqlCall aggCall,
org.apache.calcite.sql.SqlNode filter,
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 |
validateQuery(org.apache.calcite.sql.SqlNode node,
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) |
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,
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
SqlIdentifier
identifier
objects at these positionsprotected final Map<org.apache.calcite.sql.SqlNode,org.apache.calcite.sql.validate.SqlValidatorScope> scopes
query node
objects to the SqlValidatorScope
scope created from them.protected final Map<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
protected boolean expandIdentifiers
protected boolean expandColumnReferences
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.SqlConformance conformance)
opTab
- Operator tablecatalogReader
- Catalog readertypeFactory
- Type factoryconformance
- Compatibility modepublic org.apache.calcite.sql.validate.SqlConformance getConformance()
getConformance
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.validate.SqlValidatorCatalogReader getCatalogReader()
getCatalogReader
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.SqlOperatorTable getOperatorTable()
getOperatorTable
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.rel.type.RelDataTypeFactory getTypeFactory()
getTypeFactory
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.rel.type.RelDataType getUnknownType()
getUnknownType
in interface org.apache.calcite.sql.validate.SqlValidator
public 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.SqlValidator
public void declareCursor(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.validate.SqlValidatorScope parentScope)
declareCursor
in interface org.apache.calcite.sql.validate.SqlValidator
public void pushFunctionCall()
pushFunctionCall
in interface org.apache.calcite.sql.validate.SqlValidator
public void popFunctionCall()
popFunctionCall
in interface org.apache.calcite.sql.validate.SqlValidator
public String getParentCursor(String columnListParamName)
getParentCursor
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.SqlNode validate(org.apache.calcite.sql.SqlNode topNode)
validate
in interface org.apache.calcite.sql.validate.SqlValidator
public 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.SqlValidatorWithHints
public 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.SqlValidatorWithHints
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)
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.SqlValidator
public void validateQuery(org.apache.calcite.sql.SqlNode node, org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.rel.type.RelDataType targetRowType)
validateQuery
in interface org.apache.calcite.sql.validate.SqlValidator
protected 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.SqlValidator
public org.apache.calcite.sql.validate.SqlValidatorScope getSelectScope(org.apache.calcite.sql.SqlSelect select)
getSelectScope
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.validate.SelectScope getRawSelectScope(org.apache.calcite.sql.SqlSelect select)
getRawSelectScope
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.validate.SqlValidatorScope getHavingScope(org.apache.calcite.sql.SqlSelect select)
getHavingScope
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.validate.SqlValidatorScope getGroupScope(org.apache.calcite.sql.SqlSelect select)
getGroupScope
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.validate.SqlValidatorScope getFromScope(org.apache.calcite.sql.SqlSelect select)
getFromScope
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.validate.SqlValidatorScope getOrderScope(org.apache.calcite.sql.SqlSelect select)
getOrderScope
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.validate.SqlValidatorScope getMatchRecognizeScope(org.apache.calcite.sql.SqlMatchRecognize node)
getMatchRecognizeScope
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.validate.SqlValidatorScope getJoinScope(org.apache.calcite.sql.SqlNode node)
getJoinScope
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.validate.SqlValidatorScope getOverScope(org.apache.calcite.sql.SqlNode node)
getOverScope
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.validate.SqlValidatorNamespace getNamespace(org.apache.calcite.sql.SqlNode node)
getNamespace
in interface org.apache.calcite.sql.validate.SqlValidator
protected org.apache.calcite.sql.SqlNode performUnconditionalRewrites(org.apache.calcite.sql.SqlNode node, boolean underFrom)
node
- expression to be rewrittenunderFrom
- whether node appears directly under a FROM clauseprotected 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.SqlValidator
public org.apache.calcite.rel.type.RelDataType getValidatedNodeTypeIfKnown(org.apache.calcite.sql.SqlNode node)
getValidatedNodeTypeIfKnown
in interface org.apache.calcite.sql.validate.SqlValidator
public 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.SqlValidator
node
- 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.SqlValidator
public 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.SqlValidator
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, org.apache.calcite.sql.SqlFunction resolvedConstructor, List<org.apache.calcite.rel.type.RelDataType> argTypes)
deriveConstructorType
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.runtime.CalciteException handleUnresolvedFunction(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.SqlFunction unresolvedFunction, List<org.apache.calcite.rel.type.RelDataType> argTypes, List<String> argNames)
handleUnresolvedFunction
in interface org.apache.calcite.sql.validate.SqlValidator
protected 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.SqlValidatorScope scope, boolean includeSystemVars)
public String deriveAlias(org.apache.calcite.sql.SqlNode node, int ordinal)
deriveAlias
in interface org.apache.calcite.sql.validate.SqlValidator
public void setIdentifierExpansion(boolean expandIdentifiers)
setIdentifierExpansion
in interface org.apache.calcite.sql.validate.SqlValidator
public void setColumnReferenceExpansion(boolean expandColumnReferences)
setColumnReferenceExpansion
in interface org.apache.calcite.sql.validate.SqlValidator
public boolean getColumnReferenceExpansion()
getColumnReferenceExpansion
in interface org.apache.calcite.sql.validate.SqlValidator
public void setDefaultNullCollation(org.apache.calcite.config.NullCollation nullCollation)
setDefaultNullCollation
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.config.NullCollation getDefaultNullCollation()
getDefaultNullCollation
in interface org.apache.calcite.sql.validate.SqlValidator
public void setCallRewrite(boolean rewriteCalls)
setCallRewrite
in interface org.apache.calcite.sql.validate.SqlValidator
public boolean shouldExpandIdentifiers()
shouldExpandIdentifiers
in interface org.apache.calcite.sql.validate.SqlValidator
protected boolean shouldAllowIntermediateOrderBy()
protected org.apache.calcite.sql.validate.MatchRecognizeNamespace createMatchRecognizeNameSpace(org.apache.calcite.sql.SqlMatchRecognize call, org.apache.calcite.sql.SqlNode enclosingNode)
protected void registerNamespace(org.apache.calcite.sql.validate.SqlValidatorScope usingScope, 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.SqlValidator
protected boolean isNestedAggregateWindow(org.apache.calcite.sql.SqlNode node)
protected boolean isOverAggregateWindow(org.apache.calcite.sql.SqlNode node)
protected 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.
public boolean isAggregate(org.apache.calcite.sql.SqlNode selectNode)
isAggregate
in interface org.apache.calcite.sql.validate.SqlValidator
public void validateIdentifier(org.apache.calcite.sql.SqlIdentifier id, org.apache.calcite.sql.validate.SqlValidatorScope scope)
validateIdentifier
in interface org.apache.calcite.sql.validate.SqlValidator
public void validateLiteral(org.apache.calcite.sql.SqlLiteral literal)
validateLiteral
in interface org.apache.calcite.sql.validate.SqlValidator
public void validateIntervalQualifier(org.apache.calcite.sql.SqlIntervalQualifier qualifier)
validateIntervalQualifier
in interface org.apache.calcite.sql.validate.SqlValidator
protected 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 validateOver(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidatorScope scope)
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.SqlValidator
protected 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.SqlValidator
public void validateWithItem(org.apache.calcite.sql.SqlWithItem withItem)
validateWithItem
in interface org.apache.calcite.sql.validate.SqlValidator
public void validateSequenceValue(org.apache.calcite.sql.validate.SqlValidatorScope scope, org.apache.calcite.sql.SqlIdentifier id)
validateSequenceValue
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.sql.validate.SqlValidatorScope getWithScope(org.apache.calcite.sql.SqlNode withItem)
getWithScope
in interface org.apache.calcite.sql.validate.SqlValidator
protected 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.SqlValidator
protected 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, 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
baseRowType
public void validateInsert(org.apache.calcite.sql.SqlInsert insert)
validateInsert
in interface org.apache.calcite.sql.validate.SqlValidator
protected 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(org.apache.calcite.rel.type.RelDataType sourceRowType, org.apache.calcite.rel.type.RelDataType targetRowType, org.apache.calcite.sql.SqlNode query)
public void validateDelete(org.apache.calcite.sql.SqlDelete call)
validateDelete
in interface org.apache.calcite.sql.validate.SqlValidator
public void validateUpdate(org.apache.calcite.sql.SqlUpdate call)
validateUpdate
in interface org.apache.calcite.sql.validate.SqlValidator
public void validateMerge(org.apache.calcite.sql.SqlMerge call)
validateMerge
in interface org.apache.calcite.sql.validate.SqlValidator
protected 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.SqlValidator
public void validateDynamicParam(org.apache.calcite.sql.SqlDynamicParam dynamicParam)
validateDynamicParam
in interface org.apache.calcite.sql.validate.SqlValidator
public 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.SqlValidator
protected 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, boolean populateBounds)
resolveWindow
in interface org.apache.calcite.sql.validate.SqlValidator
public 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, org.apache.calcite.sql.SqlCall call)
validateWindow
in interface org.apache.calcite.sql.validate.SqlValidator
public void validateMatchRecognize(org.apache.calcite.sql.SqlCall call)
validateMatchRecognize
in interface org.apache.calcite.sql.validate.SqlValidator
public void validateAggregateParams(org.apache.calcite.sql.SqlCall aggCall, org.apache.calcite.sql.SqlNode filter, org.apache.calcite.sql.validate.SqlValidatorScope scope)
validateAggregateParams
in interface org.apache.calcite.sql.validate.SqlValidator
public void validateCall(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidatorScope scope)
validateCall
in interface org.apache.calcite.sql.validate.SqlValidator
protected 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 expand(org.apache.calcite.sql.SqlNode expr, org.apache.calcite.sql.validate.SqlValidatorScope scope)
expand
in interface org.apache.calcite.sql.validate.SqlValidator
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)
public boolean isSystemField(org.apache.calcite.rel.type.RelDataTypeField field)
isSystemField
in interface org.apache.calcite.sql.validate.SqlValidator
public List<List<String>> getFieldOrigins(org.apache.calcite.sql.SqlNode sqlQuery)
getFieldOrigins
in interface org.apache.calcite.sql.validate.SqlValidator
public org.apache.calcite.rel.type.RelDataType getParameterRowType(org.apache.calcite.sql.SqlNode sqlQuery)
getParameterRowType
in interface org.apache.calcite.sql.validate.SqlValidator
public 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.SqlValidator
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.