Skip to content

drivers: implement count_distinct in the SQL family — enforcement half of the #6188 ruling #6409

Description

@os-project-manager

Follow-up filed from the 2026-08-07 maintainer ruling on #6188 (decision batch accepted via the PM session). Unclaimed; no labels applied — routing belongs to the triage seat.

Ruling context

#6188 was ruled as a split: array_agg / string_agg retire from AggregationFunction (that card keeps the spec retirement half), while count_distinct stays declared and gets enforced — this card is the enforcement half.

Scope

Implement count_distinct in the SQL family:

  • packages/drivers/driver-sqlSqlDriver.mapAggregateFunc (currently rejects it alongside the two now-retiring keys): lower to COUNT(DISTINCT column).
  • packages/drivers/driver-turso (or wherever RemoteTransport.aggregate lives per current main) — same lowering on the remote path.

Out of scope: driver-mongodb / driver-memory (inside the #5499 investment freeze; their existing partial implementations are untouched either way).

Acceptance

  • An analytics query using count_distinct compiles and returns correct values on the SQL family (dedup semantics: distinct non-null values of the target column).
  • A conformance cell covering count_distinct is added to the shared cases so the two SQL lowerings are pinned against each other (multi-face component rule: shared coverage, not a standalone test file).
  • The rejection message for unknown aggregation functions no longer names count_distinct as unsupported.

Ordering

Independent of the #6188 retirement half (different keys, different files); no Blocked-by needed. If the retirement PR touches the same mapAggregateFunc switch, serialize per same-file discipline.

Refs: #6188 (ruling), #5907 (runtime capability-gap envelope — its wording loses these keys as subjects once both halves land), #5499 (freeze boundary).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions