Class ColumnSourceWithReferences
Object
gudusoft.gsqlparser.resolver2.model.ColumnSourceWithReferences
Enhanced column source that supports multiple reference traceability.
A normalized column name may correspond to multiple original references in SQL.
For example, in Oracle SQL SELECT "Column1", column1 FROM dual:
- Both "Column1" and column1 normalize to COLUMN1
- This class stores the canonical ColumnSource plus all original references
- Output shows one column (deduplication)
- All original positions can be traced back
Design pattern: Aggregator for Many-to-One mapping
- Multiple original identifiers (different syntax) → One semantic identifier
- Maintains link from semantic identifier back to all original identifiers
- Since:
- 3.1.0.9
-
Constructor Summary
ConstructorsConstructorDescriptionColumnSourceWithReferences(String normalizedName, ColumnSource canonicalSource) Create a new column source with references. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an original reference.Get all original texts from all references.Get all original references.Get the first (canonical) reference.Get the canonical column source.Get the normalized name.intGet the number of references.booleanCheck if there are multiple references (indicating deduplication occurred).toString()
-
Constructor Details
-
ColumnSourceWithReferences
Create a new column source with references.- Parameters:
normalizedName- normalized column namecanonicalSource- the canonical column source
-
-
Method Details
-
addReference
Add an original reference.- Parameters:
ref- the column reference to add
-
getAllReferences
Get all original references.- Returns:
- unmodifiable list of all references in order of appearance
-
getReferenceCount
Get the number of references.- Returns:
- reference count
-
hasMultipleReferences
Check if there are multiple references (indicating deduplication occurred).- Returns:
- true if more than one reference exists
-
getCanonicalReference
Get the first (canonical) reference.- Returns:
- the first reference, or null if none
-
getNormalizedName
Get the normalized name.- Returns:
- normalized column name
-
getCanonicalSource
Get the canonical column source.- Returns:
- the column source for resolution
-
getAllOriginalTexts
Get all original texts from all references.- Returns:
- list of original text strings
-
toString
-