Package gudusoft.gsqlparser.resolver2
Class ScopeBuildResult
Object
gudusoft.gsqlparser.resolver2.ScopeBuildResult
Result of scope building by ScopeBuilder.
Contains the complete scope tree and column mappings.
-
Constructor Summary
ConstructorsConstructorDescriptionScopeBuildResult(GlobalScope globalScope, Map<TObjectName, IScope> columnToScopeMap, List<TObjectName> allColumnReferences, Map<TSelectSqlStatement, SelectScope> statementScopeMap, Map<TObjectName, TTable> usingColumnToRightTable) ScopeBuildResult(GlobalScope globalScope, Map<TObjectName, IScope> columnToScopeMap, List<TObjectName> allColumnReferences, Map<TSelectSqlStatement, SelectScope> statementScopeMap, Map<TObjectName, TTable> usingColumnToRightTable, Map<TObjectName, TTable> usingColumnToLeftTable) ScopeBuildResult(GlobalScope globalScope, Map<TObjectName, IScope> columnToScopeMap, List<TObjectName> allColumnReferences, Map<TSelectSqlStatement, SelectScope> statementScopeMap, Map<TObjectName, TTable> usingColumnToRightTable, Map<TObjectName, TTable> usingColumnToLeftTable, Map<TTable, INamespace> tableToNamespaceMap) ScopeBuildResult(GlobalScope globalScope, Map<TObjectName, IScope> columnToScopeMap, List<TObjectName> allColumnReferences, Map<TSelectSqlStatement, SelectScope> statementScopeMap, Map<TObjectName, TTable> usingColumnToRightTable, Map<TObjectName, TTable> usingColumnToLeftTable, Map<TTable, INamespace> tableToNamespaceMap, Set<TTable> ctasTargetTables) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumnReferences(List<TObjectName> columns) Add column references to the internal list.Dump all column references for debuggingDump scope tree for debuggingGet all CTAS target tablesGet all CTENamespaces from the scope tree.getNamespaceForTable(TTable table) Get the namespace for a specific table.Get all PivotNamespaces from the scope tree.getScopeForColumn(TObjectName column) Get the scope for a specific column referenceGet the SelectScope for a specific statementGet statistics about the build resultGet all TTable -> INamespace mappingsgetUsingColumnLeftTable(TObjectName column) Get the left-side table for a USING column.getUsingColumnRightTable(TObjectName column) Get the right-side table for a USING column.Get all USING column -> left-side table mappingsGet all USING column -> right-side table mappingsbooleanisCTASTargetTable(TTable table) Check if a table is a CTAS target table (table being created by CREATE TABLE AS SELECT).toString()
-
Constructor Details
-
ScopeBuildResult
public ScopeBuildResult(GlobalScope globalScope, Map<TObjectName, IScope> columnToScopeMap, List<TObjectName> allColumnReferences, Map<TSelectSqlStatement, SelectScope> statementScopeMap, Map<TObjectName, TTable> usingColumnToRightTable) -
ScopeBuildResult
public ScopeBuildResult(GlobalScope globalScope, Map<TObjectName, IScope> columnToScopeMap, List<TObjectName> allColumnReferences, Map<TSelectSqlStatement, SelectScope> statementScopeMap, Map<TObjectName, TTable> usingColumnToRightTable, Map<TObjectName, TTable> usingColumnToLeftTable) -
ScopeBuildResult
public ScopeBuildResult(GlobalScope globalScope, Map<TObjectName, IScope> columnToScopeMap, List<TObjectName> allColumnReferences, Map<TSelectSqlStatement, SelectScope> statementScopeMap, Map<TObjectName, TTable> usingColumnToRightTable, Map<TObjectName, TTable> usingColumnToLeftTable, Map<TTable, INamespace> tableToNamespaceMap) -
ScopeBuildResult
public ScopeBuildResult(GlobalScope globalScope, Map<TObjectName, IScope> columnToScopeMap, List<TObjectName> allColumnReferences, Map<TSelectSqlStatement, SelectScope> statementScopeMap, Map<TObjectName, TTable> usingColumnToRightTable, Map<TObjectName, TTable> usingColumnToLeftTable, Map<TTable, INamespace> tableToNamespaceMap, Set<TTable> ctasTargetTables)
-
-
Method Details
-
getGlobalScope
-
getColumnToScopeMap
-
getAllColumnReferences
-
addColumnReferences
Add column references to the internal list. Used by TSQLResolver2 to add cloned columns for star column tracing.- Parameters:
columns- the column references to add
-
getStatementScopeMap
-
getScopeForColumn
Get the scope for a specific column reference -
getScopeForStatement
Get the SelectScope for a specific statement -
getUsingColumnRightTable
Get the right-side table for a USING column. In JOIN...USING syntax, USING columns should preferentially resolve to the right-side (physical) table.- Parameters:
column- the USING column TObjectName- Returns:
- the right-side TTable, or null if not a USING column
-
getUsingColumnToRightTable
Get all USING column -> right-side table mappings -
getUsingColumnLeftTable
Get the left-side table for a USING column. In JOIN...USING syntax, the USING column also applies to the left-side table.- Parameters:
column- the USING column TObjectName- Returns:
- the left-side TTable, or null if not a USING column
-
getUsingColumnToLeftTable
Get all USING column -> left-side table mappings -
getNamespaceForTable
Get the namespace for a specific table. Used for legacy compatibility to fill TTable.getAttributes().- Parameters:
table- the TTable to look up- Returns:
- the INamespace for this table, or null if not found
-
getTableToNamespaceMap
Get all TTable -> INamespace mappings -
isCTASTargetTable
Check if a table is a CTAS target table (table being created by CREATE TABLE AS SELECT). CTAS target tables are DDL targets, not existing physical tables.- Parameters:
table- the TTable to check- Returns:
- true if this is a CTAS target table
-
getCTASTargetTables
Get all CTAS target tables -
getCTENamespaces
Get all CTENamespaces from the scope tree. Searches through all scopes to find CTE namespaces.- Returns:
- Map of CTE name -> CTENamespace
-
getPivotNamespaces
Get all PivotNamespaces from the scope tree. Searches through all scopes to find PIVOT namespaces.- Returns:
- List of PivotNamespace objects
-
getStatistics
Get statistics about the build result -
dumpScopeTree
Dump scope tree for debugging -
dumpColumnReferences
Dump all column references for debugging -
toString
-