Description
GIQL now hides synthesized __giql_-prefixed columns from query output via three hand-rolled mechanisms across the operator expanders:
Each solves the same class of problem (a synthesized __giql_ column leaking through a star projection), and each is the Nth member of the #161 reserved-identifier family. A future operator that synthesizes a starred column must remember to hand-roll a fourth.
Motivation
The divergence is currently correct but is latent tech debt: three mechanisms, two of them (* EXCEPT emission) duplicated, and no single place that owns "no __giql_ column reaches user output." Consolidating would let operators stop each re-implementing exclusion.
Constraint (do not lose this)
A naive "single finalizer that wraps the final SELECT in * EXCEPT" is incorrect for CLUSTER: transplant re-attaches the user's DISTINCT onto CLUSTER's outer query, so an outer wrapper would dedup over the flag before stripping it (splitting rows that should collapse). CLUSTER's flag must be excised at the same projection level as any preserved DISTINCT, which is why CLUSTER hides eagerly rather than via NEAREST's wrapping finalizer. Any unified pass must strip at the projection level, not by adding an outer wrapper, for operators whose result-shaping clauses (DISTINCT/QUALIFY) are preserved onto that projection.
Expected outcome
A single reserved-column output-hygiene mechanism, keyed on the __giql_ prefix, that both CLUSTER and NEAREST (and the canonicalizer, where applicable) route through — respecting the DISTINCT-level constraint above — so new operators inherit output hygiene instead of hand-rolling it.
Scope / relationship
Discovered during the #184 review (PR #186). Low priority; the current per-operator mechanisms are correct.
Description
GIQL now hides synthesized
__giql_-prefixed columns from query output via three hand-rolled mechanisms across the operator expanders:metatag and wraps the enclosing SELECT inSELECT * EXCEPT (reserved...)only when a star surfaces the reserved rank/key columns.* EXCEPT (__giql_is_new_cluster)at expansion time.* EXCEPT/* REPLACEde-canonicalization wrapper.Each solves the same class of problem (a synthesized
__giql_column leaking through a star projection), and each is the Nth member of the #161 reserved-identifier family. A future operator that synthesizes a starred column must remember to hand-roll a fourth.Motivation
The divergence is currently correct but is latent tech debt: three mechanisms, two of them (
* EXCEPTemission) duplicated, and no single place that owns "no__giql_column reaches user output." Consolidating would let operators stop each re-implementing exclusion.Constraint (do not lose this)
A naive "single finalizer that wraps the final SELECT in
* EXCEPT" is incorrect for CLUSTER:transplantre-attaches the user'sDISTINCTonto CLUSTER's outer query, so an outer wrapper would dedup over the flag before stripping it (splitting rows that should collapse). CLUSTER's flag must be excised at the same projection level as any preservedDISTINCT, which is why CLUSTER hides eagerly rather than via NEAREST's wrapping finalizer. Any unified pass must strip at the projection level, not by adding an outer wrapper, for operators whose result-shaping clauses (DISTINCT/QUALIFY) are preserved onto that projection.Expected outcome
A single reserved-column output-hygiene mechanism, keyed on the
__giql_prefix, that both CLUSTER and NEAREST (and the canonicalizer, where applicable) route through — respecting the DISTINCT-level constraint above — so new operators inherit output hygiene instead of hand-rolling it.Scope / relationship
Discovered during the #184 review (PR #186). Low priority; the current per-operator mechanisms are correct.