public class SubqueryNamespace extends AbstractNamespace
columnSources, columnSourcesWithRefs, guessColumnStrategy, nameMatcher, node, referenceTraceabilityEnabled, validated| Constructor and Description |
|---|
SubqueryNamespace(TSelectSqlStatement subquery,
String alias) |
SubqueryNamespace(TSelectSqlStatement subquery,
String alias,
INameMatcher nameMatcher) |
SubqueryNamespace(TSelectSqlStatement subquery,
String alias,
INameMatcher nameMatcher,
boolean fromTableFunction) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addInferredColumn(String columnName,
double confidence,
String evidence)
Add an inferred column to this namespace.
|
protected void |
doValidate()
Subclasses override this to perform actual validation logic.
|
List<TTable> |
getAllFinalTables()
Get all final physical tables this namespace depends on.
|
String |
getDisplayName()
Get a display name for this namespace (for debugging/error messages)
|
TTable |
getFinalTable()
Get the final physical table this namespace represents.
|
Set<String> |
getInferredColumns()
Get all columns that were inferred (not from SELECT list directly).
|
MetadataState |
getMetadataState()
Slice S4 (plan §5.5): a derived subquery's projection is authoritative
once validated AND at least one named (non-star) column exists.
|
TSelectSqlStatement |
getSelectStatement()
Get the underlying SELECT statement for this namespace.
|
TTable |
getSourceTable()
Get the TTable that this namespace is associated with.
|
TSQLEnv |
getSqlEnv()
Get the TSQLEnv used for metadata lookup.
|
TResultColumn |
getStarColumn()
Get the first star column (TResultColumn) from this subquery's SELECT list.
|
TSelectSqlStatement |
getSubquery() |
boolean |
hasAmbiguousStar()
Check if this subquery has an unqualified star with multiple tables.
|
ColumnLevel |
hasAuthoritativeOutputColumn(String columnName)
Binding-diagnostic view of the derived-table output schema.
|
ColumnLevel |
hasColumn(String columnName)
Check if a column exists in this namespace.
|
boolean |
hasStarColumn()
Check if this namespace contains a star column (SELECT *).
|
boolean |
isFromTableFunction()
Returns true if this namespace was created from a TABLE function's subquery.
|
ColumnSource |
resolveColumn(String columnName)
Resolve a column name to its source.
|
ColumnSource |
resolveColumnInFromScope(String columnName)
Resolve a column in the FROM scope (child namespaces).
|
void |
setSourceTable(TTable sourceTable)
Set the TTable that wraps this subquery.
|
void |
setSqlEnv(TSQLEnv sqlEnv)
Set the TSQLEnv for metadata lookup.
|
boolean |
supportsDynamicInference()
Check if this namespace supports dynamic column inference.
|
String |
toString() |
addColumnSource, addColumnSource, containsColumnByMatcher, containsColumnNameByMatcher, enableReferenceTraceability, ensureValidated, getAllColumnSources, getAllUniqueColumns, getColumnReferences, getColumnSourceWithReferences, getGuessColumnStrategy, getNameMatcher, getNode, isReferenceTraceabilityEnabled, isValidated, setGuessColumnStrategy, validateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitresolveColumnPathpublic SubqueryNamespace(TSelectSqlStatement subquery, String alias, INameMatcher nameMatcher)
public SubqueryNamespace(TSelectSqlStatement subquery, String alias, INameMatcher nameMatcher, boolean fromTableFunction)
public SubqueryNamespace(TSelectSqlStatement subquery, String alias)
public boolean isFromTableFunction()
public void setSourceTable(TTable sourceTable)
sourceTable - the TTable that contains this subquerypublic TTable getSourceTable()
INamespacepublic void setSqlEnv(TSQLEnv sqlEnv)
sqlEnv - the SQL environment containing table metadatapublic TSQLEnv getSqlEnv()
public String getDisplayName()
INamespacepublic TTable getFinalTable()
INamespacepublic List<TTable> getAllFinalTables()
INamespacegetAllFinalTables in interface INamespacegetAllFinalTables in class AbstractNamespaceprotected void doValidate()
AbstractNamespacedoValidate in class AbstractNamespacepublic ColumnLevel hasColumn(String columnName)
INamespacehasColumn in interface INamespacehasColumn in class AbstractNamespacecolumnName - Column name to checkpublic TSelectSqlStatement getSubquery()
public TSelectSqlStatement getSelectStatement()
INamespacepublic boolean hasStarColumn()
INamespacepublic MetadataState getMetadataState()
SELECT * is reported as
METADATA_UNAVAILABLE here — S10 refines this when the underlying tables'
star expansion fully resolves into named columns.nullpublic ColumnLevel hasAuthoritativeOutputColumn(String columnName)
This deliberately avoids the legacy resolution fallbacks in
resolveColumn(String). Binding diagnostics need the SQL-visible
derived projection: named SELECT-list columns and already inferred star
output columns are visible; hidden base-table columns are not. When the
projection includes a star and the requested column is not already known,
the output is not fully authoritative, so callers must not report a
missing-output error.
public TResultColumn getStarColumn()
public boolean hasAmbiguousStar()
public boolean supportsDynamicInference()
INamespacepublic boolean addInferredColumn(String columnName, double confidence, String evidence)
INamespacecolumnName - the column name to addconfidence - the confidence score (0.0 to 1.0)evidence - description of why this column was inferredpublic Set<String> getInferredColumns()
INamespacepublic ColumnSource resolveColumn(String columnName)
INamespaceresolveColumn in interface INamespaceresolveColumn in class AbstractNamespacecolumnName - Column name to resolvepublic ColumnSource resolveColumnInFromScope(String columnName)
Unlike resolveColumn() which returns columns from THIS subquery's SELECT list, this method looks into the FROM clause to find the underlying definition.
IMPORTANT: For TableNamespace, this only returns columns that exist in actual metadata (from DDL or SQLEnv). It does NOT use inferred columns. This is critical for multi-table star resolution where we need to know which table actually has the column based on metadata, not inference.
columnName - The column name to findpublic String toString()
toString in class AbstractNamespace