Skip to content

Consolidate synthesized __giql_ column hiding into a single output-hygiene mechanism #187

Description

@conradbzura

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorCode restructuring without behavior change

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions