public class DynamicStarSource extends AbstractNamespace
This namespace represents a table or subquery where we have SELECT * but no schema information. It dynamically infers columns based on: - Usage in WHERE clauses - Usage in JOIN conditions - Usage in other parts of the query
Example scenario:
-- No metadata available for employees table SELECT * FROM employees e WHERE e.department_id = 10 AND e.salary > 50000 DynamicStarSource will infer: - "department_id" column (from WHERE clause) - "salary" column (from WHERE clause)
The inference is done lazily - columns are added as evidence is discovered during resolution. This allows the resolver to handle queries without schema information.
Confidence scoring: - Qualified references (t.col): High confidence (0.95) - JOIN conditions: Very high confidence (0.9) - Unqualified references: Lower confidence (0.5-0.8)
columnSources, columnSourcesWithRefs, guessColumnStrategy, nameMatcher, node, referenceTraceabilityEnabled, validated| Constructor and Description |
|---|
DynamicStarSource(TTable table,
INameMatcher nameMatcher) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInferredColumn(String columnName,
ColumnSource columnSource)
Add a dynamically inferred column from an existing ColumnSource.
|
boolean |
addInferredColumn(String columnName,
double confidence,
String evidence)
Add a dynamically inferred column.
|
protected void |
doValidate()
Subclasses override this to perform actual validation logic.
|
Map<String,ColumnSource> |
getAllColumnSources()
Get all column sources exposed by this namespace.
|
String |
getDisplayName()
Get a display name for this namespace (for debugging/error messages)
|
TTable |
getFinalTable()
Get the final physical table this namespace represents.
|
InferenceEngine |
getInferenceEngine()
Get the inference engine for this star source.
|
int |
getInferredColumnCount()
Get the number of dynamically inferred columns.
|
Set<String> |
getInferredColumns()
Get all columns that were inferred (not from SELECT list directly).
|
String |
getStatistics()
Get statistics about this dynamic star source.
|
ColumnLevel |
hasColumn(String columnName)
Check if a column exists in this namespace.
|
boolean |
hasInferredColumns()
Check if any columns have been inferred.
|
boolean |
hasStarColumn()
Check if this namespace contains a star column (SELECT *).
|
void |
inferColumnsFromEvidence()
Infer columns from the inference engine's evidence.
|
ColumnSource |
resolveColumn(String columnName)
Resolve a column name to its source.
|
boolean |
supportsDynamicInference()
Check if this namespace supports dynamic column inference.
|
String |
toString() |
addColumnSource, addColumnSource, enableReferenceTraceability, ensureValidated, getAllFinalTables, getAllUniqueColumns, getColumnReferences, getColumnSourceWithReferences, getGuessColumnStrategy, getNameMatcher, getNode, isReferenceTraceabilityEnabled, isValidated, setGuessColumnStrategy, validateclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSelectStatement, getSourceTable, getStarColumn, resolveColumnPathpublic DynamicStarSource(TTable table, INameMatcher nameMatcher)
public InferenceEngine getInferenceEngine()
public boolean addInferredColumn(String columnName, double confidence, String evidence)
columnName - the column nameconfidence - the confidence scoreevidence - the evidence descriptionpublic void addInferredColumn(String columnName, ColumnSource columnSource)
columnName - the column namecolumnSource - the column source with confidence and evidencepublic void inferColumnsFromEvidence()
protected void doValidate()
AbstractNamespacedoValidate in class AbstractNamespacepublic ColumnLevel hasColumn(String columnName)
INamespacehasColumn in interface INamespacehasColumn in class AbstractNamespacecolumnName - Column name to checkpublic ColumnSource resolveColumn(String columnName)
INamespaceresolveColumn in interface INamespaceresolveColumn in class AbstractNamespacecolumnName - Column name to resolvepublic Map<String,ColumnSource> getAllColumnSources()
INamespacegetAllColumnSources in interface INamespacegetAllColumnSources in class AbstractNamespacepublic TTable getFinalTable()
INamespacepublic String getDisplayName()
INamespacepublic int getInferredColumnCount()
public boolean hasInferredColumns()
public String getStatistics()
public boolean supportsDynamicInference()
INamespacepublic Set<String> getInferredColumns()
INamespacepublic boolean hasStarColumn()
INamespacepublic String toString()
toString in class AbstractNamespace