public final class RelationSource extends Object
alias is
non-null and defaults to the table name when the SQL omits an alias, so
consumers always have a stable local handle to use in
ColumnRef.getRelationAlias().
For most kinds (TABLE / CTE / SUBQUERY / UNION) the source is a
FROM-clause entry on this statement. For
RelationKind.OUTER_REFERENCE (slice 14) the source is
synthesised by the builder to record an alias that actually belongs to
an enclosing scope's FROM clause; the inner statement carries it so
ColumnRef.getRelationAlias() resolves uniformly without needing
an explicit "is-outer" flag.
Join-analysis slice 164 (S3) adds an optional SourceSpan
pointing at the FROM-clause table reference (incl. alias, e.g.
t1 a) this relation was read from; the bare table name remains
available via the binding. Existing constructors default it to
null. RelationSource uses reference identity (no
equals/hashCode override), so the additive span cannot
affect dedupe.
| Modifier and Type | Field and Description |
|---|---|
static int |
NO_INSTANCE_ID
Sentinel for "no stable instance id assigned" (slice 179).
|
| Constructor and Description |
|---|
RelationSource(String alias,
RelationBinding binding) |
RelationSource(String alias,
RelationBinding binding,
SourceSpan sourceSpan) |
RelationSource(String alias,
RelationBinding binding,
SourceSpan sourceSpan,
int instanceId)
Full constructor (join-analysis slice 179).
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAlias() |
RelationBinding |
getBinding() |
int |
getInstanceId()
Stable per-block FROM-order ordinal (join-analysis slice 179, R4), or
NO_INSTANCE_ID when not assigned. |
SourceSpan |
getSourceSpan()
Optional source-text span of this relation reference (join-analysis
slice 164).
|
public static final int NO_INSTANCE_ID
public RelationSource(String alias, RelationBinding binding)
public RelationSource(String alias, RelationBinding binding, SourceSpan sourceSpan)
public RelationSource(String alias, RelationBinding binding, SourceSpan sourceSpan, int instanceId)
sourceSpan is
optional (null when the parser cannot anchor the relation).
instanceId is a stable, per-statement-block ordinal (FROM
order: driver first, then each join-item right table left-to-right)
that a JoinEndpoint of kind RELATION carries too, so an
endpoint links to its exact relation instance without relying on
alias uniqueness / case-folding (R4). NO_INSTANCE_ID when
not assigned (e.g. DML / non-join relation lists).public RelationBinding getBinding()
public SourceSpan getSourceSpan()
public int getInstanceId()
NO_INSTANCE_ID when not assigned. A RELATION-kind
JoinEndpoint carries the same value.