Skip to content

[spec] AggregationFunction 声明 8 个,SQL 族只实现 5 个 —— count_distinct / array_agg / string_agg 按 ADR-0049 enforce-or-remove 定去留 #6188

Description

@os-zhuang

#5907 分流而来(分诊 2026-08-06 明确:运行时说实话归 drivers 车道、声明面去留归 spec 座位,⛔ 不夹带)。

事实

packages/spec/src/data/query.zod.ts:108AggregationFunction 声明 8 个:

'count', 'sum', 'avg', 'min', 'max', 'count_distinct', 'array_agg', 'string_agg'

后 3 个 —— count_distinct / array_agg / string_agg —— 没有任何 SQL 后端编译:SqlDriver.mapAggregateFunc(sql-driver.ts:7071 附近)与 RemoteTransport.aggregate(remote-transport.ts:726 附近)各自只编译前 5 个,后 3 个落同一句拒绝。非 SQL 族里 driver-mongodb(mongodb-aggregation.ts:139/144/147)与 driver-memory(memory-analytics.ts:866,count_distinct)实现了其中若干,且各后端实现的子集互不相同

即 declared ≠ enforced,且「哪个后端能算什么」对作者不可预测。

需要一次裁决(spec 座位)

drivers 侧的运行时半边(让第 2 类拿到能力缺口信封而不是被说成打错字)在 #5907 独立进行,不阻塞本单;本单的结论反过来会决定 #5907 那条措辞将来是长期存在还是随退役消失。

关联:#5907(运行时半边)、#5345(driver-memory 上同构的「协议没有」vs「本面降不下去」分线先例)、ADR-0049 enforce-or-remove、ADR-0087。

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions