Class TableNamespace
Object
gudusoft.gsqlparser.resolver2.namespace.AbstractNamespace
gudusoft.gsqlparser.resolver2.namespace.TableNamespace
- All Implemented Interfaces:
INamespace
Namespace representing a physical table.
Provides column information from table metadata.
Column sources come from:
1. Table metadata (if available from DDL)
2. External metadata providers (SQLEnv)
3. Inferred from usage (when no metadata available)
-
Field Summary
Fields inherited from class gudusoft.gsqlparser.resolver2.namespace.AbstractNamespace
columnSources, columnSourcesWithRefs, guessColumnStrategy, nameMatcher, node, referenceTraceabilityEnabled, validated -
Constructor Summary
ConstructorsConstructorDescriptionTableNamespace(TTable table) TableNamespace(TTable table, INameMatcher nameMatcher) TableNamespace(TTable table, INameMatcher nameMatcher, TSQLEnv sqlEnv) TableNamespace(TTable table, INameMatcher nameMatcher, TSQLEnv sqlEnv, EDbVendor vendor) Create a TableNamespace with full qualified name resolution support. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUsingColumn(String columnName) Add a USING clause column to this table's namespace.protected voidSubclasses override this to perform actual validation logic.Get a display name for this namespace (for debugging/error messages)Get the final physical table this namespace represents.Get the fully qualified name of this table.Get the qualified name resolver.Get the resolved TSQLTable from SQLEnv.Get the TTable that this namespace is associated with.Get the TSQLEnv used for metadata lookup.getTable()Get the database vendor.Check if a column exists in this namespace.booleanReturns true if this namespace has actual metadata (from DDL or SQLEnv).resolveColumn(String columnName) Resolve a column name to its source.voidSet the TSQLEnv for metadata lookup.voidSet the database vendor.toString()Methods inherited from class gudusoft.gsqlparser.resolver2.namespace.AbstractNamespace
addColumnSource, addColumnSource, enableReferenceTraceability, ensureValidated, getAllColumnSources, getAllFinalTables, getAllUniqueColumns, getColumnReferences, getColumnSourceWithReferences, getGuessColumnStrategy, getNameMatcher, getNode, isReferenceTraceabilityEnabled, isValidated, setGuessColumnStrategy, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gudusoft.gsqlparser.resolver2.namespace.INamespace
addInferredColumn, getInferredColumns, getSelectStatement, getStarColumn, hasStarColumn, resolveColumnPath, supportsDynamicInference
-
Constructor Details
-
TableNamespace
-
TableNamespace
-
TableNamespace
Create a TableNamespace with full qualified name resolution support.- Parameters:
table- The table AST nodenameMatcher- The name matcher for case sensitivitysqlEnv- The SQL environment for metadata lookupvendor- The database vendor
-
TableNamespace
-
-
Method Details
-
setSqlEnv
Set the TSQLEnv for metadata lookup.- Parameters:
sqlEnv- the SQL environment containing table metadata
-
getSqlEnv
Get the TSQLEnv used for metadata lookup.- Returns:
- the SQL environment, or null if not set
-
setVendor
Set the database vendor.- Parameters:
vendor- the database vendor
-
getVendor
Get the database vendor.- Returns:
- the database vendor, or null if not set
-
getQualifiedNameResolver
Get the qualified name resolver.- Returns:
- the resolver, or null if sqlEnv is not set
-
getQualifiedName
Get the fully qualified name of this table.The qualified name is computed by applying defaults from TSQLEnv to the table's partial name.
- Returns:
- the qualified name, or null if table name is unavailable
-
getResolvedTable
Get the resolved TSQLTable from SQLEnv.- Returns:
- the resolved table, or null if not found in SQLEnv
-
getDisplayName
Description copied from interface:INamespaceGet a display name for this namespace (for debugging/error messages) -
getFinalTable
Description copied from interface:INamespaceGet the final physical table this namespace represents. For tables: returns the table itself For subqueries/CTEs: recursively traces back to physical table(s)- Returns:
- Physical table, or null if not determinable
-
getSourceTable
Description copied from interface:INamespaceGet the TTable that this namespace is associated with. Used for legacy sync to set TObjectName.sourceTable. For TableNamespace: returns the table itself For SubqueryNamespace: returns the TTable wrapping the subquery For CTENamespace: returns the CTE referencing table For others: returns null- Returns:
- The source TTable, or null if not applicable
-
doValidate
Description copied from class:AbstractNamespaceSubclasses override this to perform actual validation logic.- Specified by:
doValidatein classAbstractNamespace
-
hasColumn
Description copied from interface:INamespaceCheck if a column exists in this namespace. Returns a three-level answer: EXISTS, MAYBE, NOT_EXISTS- Specified by:
hasColumnin interfaceINamespace- Overrides:
hasColumnin classAbstractNamespace- Parameters:
columnName- Column name to check- Returns:
- Column existence level
-
resolveColumn
Description copied from interface:INamespaceResolve a column name to its source.- Specified by:
resolveColumnin interfaceINamespace- Overrides:
resolveColumnin classAbstractNamespace- Parameters:
columnName- Column name to resolve- Returns:
- ColumnSource if found, null otherwise
-
getTable
-
hasMetadata
Returns true if this namespace has actual metadata (from DDL or SQLEnv). When false, column resolution will infer columns from usage.- Returns:
- true if metadata is available, false if columns are inferred
-
addUsingColumn
Add a USING clause column to this table's namespace. This is called during scope building when a JOIN...USING clause includes columns from this table. The USING column exists in BOTH tables of the join.- Parameters:
columnName- the name of the USING column
-
toString
- Overrides:
toStringin classAbstractNamespace
-