Repository navigation
docs(data): count_distinct is lowered on the SQL family; state the real limit - #21085
Conversation
Contract reviewServed-tier: ① Derived judgmentsBase judged: queries.mdx callout (
query-syntax.mdx callout (
Outside the diff, on both pages.
Census (hand-written Merge-cleanliness: ② Semver levelDocs only: 2 files, +23/-17. No package source is touched, and no changeset is present or owed. Clause-②: no. ③ Boundary flags
Implemented-by: VERDICT: FAIL: one wording fix. queries.mdx :384 "for every function" overstates the door while Generated by Claude Code |
Contract reviewServed-tier: ① Derived judgments
② Semver levelDocs only ( ③ Boundary flagsNone. No code, spec, test, workflow or changeset files are touched, and the diff makes no new claim beyond the one re-judged sentence. Implemented-by: VERDICT: PASS Generated by Claude Code |
Fixes #21039
Clause-②: no
What this changes
Docs only, two hand-written pages. Both said the SQL drivers refuse
count_distinctwith501 NOT_IMPLEMENTEDand that its SQL lowering is "scheduled". It has been lowered since #6409; both callouts now state whatmaindoes.Before / after
content/docs/data-modeling/queries.mdx(warn callout under the function table)count_distinctis not yet lowered by the SQL drivers ... refuse it as a capability gap,501 NOT_IMPLEMENTED... its SQL lowering is scheduled"COUNT(DISTINCT field); MongoDB, the in-memory driver and the engine's in-memory fallback count distinct non-null values; nofieldis400 INVALID_QUERY. The one real limit: a JSON-stored field (structured-JSON types,multiselect/checkboxes/tags, ormultiple: true) is400 INVALID_FIELDat the engine before any driver runs. One sentence on the merged #21037 effect (min / max / avg over a refused type answer the same400 INVALID_FIELD).content/docs/protocol/objectql/query-syntax.mdx(callout after "Schema enum", old lines 971-982)medianstill400 INVALID_QUERY, same JSON-stored limit. Callout type warn to info. This also removes the page's self-contradiction with its own line 118 (COUNT(DISTINCT field)on both SQL faces since #6409).Code anchors (origin/main a75311d)
packages/drivers/driver-sql/src/sql-driver.ts:1524(['count_distinct', { sql: 'count', distinct: true }]); emission:10252-10254(count(distinct ??)); fieldless refusal:10222callingrefuseDistinctAggregateWithoutField(:1827,INVALID_QUERY/ 400).packages/drivers/driver-turso/src/remote-transport.ts:677and:1408. Local Tursoextends SqlDriver(turso-driver.ts:631).packages/drivers/driver-memory/src/memory-driver.ts:2164(null and undefined excluded). Engine in-memory fallback:packages/objectql/src/in-memory-aggregation.ts:234. MongoDB:packages/drivers/driver-mongodb/src/mongodb-aggregation.ts:406.packages/objectql/src/aggregate-field-type-door.ts:236(assertAggregationFieldTypesAccepted;INVALID_FIELDat:261, status 400 at:262), called atpackages/objectql/src/engine.ts:16891. Table row:packages/spec/src/data/aggregate-field-type-compatibility.ts:214(count_distinct: DISTINCT_COMPARABLE_FIELD_TYPES; JSON-stored list:190-196).packages/objectql/src/engine-json-stored-group-distinct-door.test.ts:189;packages/rest/src/data-json-stored-group-distinct-door.test.ts:219(read; its SQLite cell always runs, PostgreSQL / MySQL cells are skips withoutOS_TEST_POSTGRES_URL/OS_TEST_MYSQL_URL).aggregate-field-type-door.tsis on this base, so the one sentence about min / max / avg is true on main.Census of hand-written pages mentioning
count_distinctdata-modeling/queries.mdx: stale, fixed here.protocol/objectql/query-syntax.mdx: stale at the callout, fixed here; lines 104, 118, 134 and 1067 current (118 states the lowering correctly; 134 is the interface union; 1067 points to the aggregation).ai/natural-language-queries.mdx(lines 18, 27): current. Listscount_distinctamong theaggregate_recordsfunctions, which the tool declares (packages/mcp/src/mcp-http-tools.ts:821); no capability claim.api/data-api.mdx(line 418): current. The_count_distinctmeasure suffix is the one the analytics service names (packages/services/service-analytics/src/analytics-service.ts:2882).deployment/validating-metadata.mdx(lines 210-213): current. States exactly the table row: every type except the structured-JSON types andmultiselect/checkboxes/tags(aggregate-field-type-compatibility.ts:190-214).kernel/contracts/data-engine.mdx(lines 152, 498, 509): current. "every face computes" holds for the vocabulary on all backends above; the JSON-stored limit is a field-type refusal, not a face gap.ui/dashboards.mdx(line 328): current. Function table row, no capability claim.content/docs/references/**andcontent/docs/releases/**: not touched.Gates
node scripts/pm/dispatch-gates.mjs --commands: 40 derived;--ranreports 40 run, 0 NOT-MEASURED, 0 UNRUN. Five gates (two in@objectstack/lint,check:skill-examples,check:docs-transcript-drift) first answered exit 3 PREREQUISITE NOT MET andcheck:docsexit 1 before the spec / lint / client-react packages were built; after the builds all exit 0. No changeset (docs only).🤖 Generated with Claude Code
https://claude.ai/code/session_01VDtqoecgES7ScQYGbFVDRv