Package io.trino.sql.analyzer
Class Scope
java.lang.Object
io.trino.sql.analyzer.Scope
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final class -
Method Summary
Modifier and TypeMethodDescriptionstatic Scope.Builderbuilder()static Scopecreate()getField(int index) intgetNamedQuery(String name) booleanhasOuterParent(Scope parent) booleanbooleanisLocalScope(Scope other) resolveAsteriskedIdentifierChainBasis(QualifiedName identifierChain, AllColumns selectItem) This method analyzes asterisked identifier chain in 'all fields reference', according to SQL standard.resolveField(Expression expression, QualifiedName name) toString()tryResolveField(Expression expression) tryResolveField(Expression node, QualifiedName name) withRelationType(RelationType relationType)
-
Method Details
-
create
-
builder
-
withRelationType
-
getQueryBoundaryScope
-
getOuterQueryParent
-
hasOuterParent
-
getLocalParent
-
getLocalScopeFieldCount
public int getLocalScopeFieldCount() -
getRelationId
-
getRelationType
-
resolveAsteriskedIdentifierChainBasis
public Optional<Scope.AsteriskedIdentifierChainBasis> resolveAsteriskedIdentifierChainBasis(QualifiedName identifierChain, AllColumns selectItem) This method analyzes asterisked identifier chain in 'all fields reference', according to SQL standard. The following rules are applied: 1. if the identifier chain's length is lower than 4, it is attempted to resolve it as a table reference, either in the local scope or in outer scope. 2. if the identifier chain's length is greater than 1, it is attempted to match the chain's prefix of length 2 to a field of type Row, either in the local scope or in outer scope. Any available match in the innermost scope is picked and the 'identifier chain basis' is defined. If more than one basis is defined, it results in a failure (ambiguous identifier chain).NOTE: only ambiguity between table reference and field reference is currently detected. If two or more tables in the same scope match the identifier chain, they are indistinguishable in current Scope implementation, and such query results in returning fields from all of those tables. If two or more fields in the same scope match the identifier chain, such query will fail later during analysis.
NOTE: Although references to outer scope tables are found, referencing all fields from outer scope tables is not yet supported.
-
isLocalScope
-
resolveField
-
tryResolveField
-
tryResolveField
-
getField
-
isColumnReference
-
getNamedQuery
-
toString
-