public final class StarRedundancyLedger extends Object
t.* entries of a Tables:/Fields: listing say nothing
the listing does not already say — from the identity of what was emitted, never from the
rendered text.
The rule (owner's, 2026-09-15): a star entry is listed only while it carries information. Once every column of the table it stands for has reached the output under the same table prefix, the star adds nothing and is dropped. Anything that cannot be PROVEN is kept — a redundant star is a cosmetic extra, while a star dropped in error silently deletes the only record that the table has further columns.
Why identity and not text. The namespace keys are the names as the catalog STORES them
and a rendered field is the spelling as the query WROTE it, minus the delimiters the display
layer strips. Oracle shows the two forms disagreeing in both directions: SELECT c123
renders c123 against a stored C123, and
CREATE TABLE t(foo int, "foo" int) stores FOO and foo, both of which
render as foo. No single normalization of the rendered text recovers both, measured.
So every emitted entry is recorded with what produced it and joined to the namespace by one of
three stable identities:
ColumnSource, when it IS the namespace's object (explicit
references to a FROM table carry exactly that object);ColumnSource resolver2 expanded a star into, recorded by
TSQLResolver2.getStarExpansionSource(TAttributeNode) at expansion time;TTable
occurrence, its getFinalTable(), or another occurrence of the same catalog
TSQLTable such as the CREATE TABLE that declared it — the namespace's
own lookup of the reference's lexical spelling, SQL_LEXICAL against
CATALOG_STORED through IdentifierService.Two entries that render to the same text are one line in the output. A column that only reached the output as such a shared line has not reached it in any way a reader can see, so it does not count, and the star survives to say that the table has more.
One star text can stand for several table occurrences (SELECT * FROM t; SELECT t.*
FROM t); it is dropped only when every one of them is proven. And the star texts are kept
apart from the column entries by the callers, so a column whose bare display name happens to
be * can never be reached by the pruning at all.
| Constructor and Description |
|---|
StarRedundancyLedger(TSQLResolver2 resolver,
EDbVendor vendor) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
hasStars() |
void |
recordColumn(String prefix,
String rendered,
TObjectName column,
TTable renderedTable)
A column entry written as
rendered for the reference column, shown under prefix as a column of renderedTable. |
void |
recordExpandedAttribute(String prefix,
String rendered,
TAttributeNode attribute)
A column entry written as
rendered from a star's expanded attribute. |
void |
recordForeignLine(String rendered)
A line the writer put into its output WITHOUT a producer this ledger can name — an orphan's
missed. line, a DDL constraint column, a PIVOT output column. |
void |
recordNamespaceColumn(String prefix,
String rendered,
ColumnSource source)
A column entry written as
rendered directly for a namespace member. |
void |
recordStar(String text,
String prefix,
TTable table)
A star entry that would be written as
text, standing for table, under prefix. |
Set<String> |
redundantStarEntries(Collection<String> finalLines)
The star texts that every recorded occurrence proves redundant.
|
public StarRedundancyLedger(TSQLResolver2 resolver, EDbVendor vendor)
resolver - the resolver whose scope build the output was produced from; null
when there is none (the legacy resolver), in which case nothing can be
proven and every star is keptvendor - the vendor whose identifier rules apply; null disables the lexical
join, which again only keeps starspublic void recordStar(String text, String prefix, TTable table)
text, standing for table, under prefix.public void recordColumn(String prefix, String rendered, TObjectName column, TTable renderedTable)
rendered for the reference column, shown under prefix as a column of renderedTable.public void recordExpandedAttribute(String prefix, String rendered, TAttributeNode attribute)
rendered from a star's expanded attribute.public void recordNamespaceColumn(String prefix, String rendered, ColumnSource source)
rendered directly for a namespace member.public void recordForeignLine(String rendered)
missed. line, a DDL constraint column, a PIVOT output column. It can prove nothing,
but it still folds with recorded lines in the writer's de-duplication, and a member whose
only line it swallowed has not reached the reader. So it is bucketed like every other line.public boolean hasStars()
public void clear()
public Set<String> redundantStarEntries(Collection<String> finalLines)
finalLines - every column line the writer has already put into its output, whether or
not it was recorded here. A line that reached the output without passing
through this ledger (an orphan missed. line, a DDL constraint
column) still folds with the recorded lines in the writer's
de-duplication, so it takes part in the collision accounting as a line
that stands for nothing this ledger can name.