You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8e48947
Browse filesBrowse the repository at this point in the historyBrowse files
docs(spec, driver-sql): state that text in a measure filter compares by the backend collation
The aggregationFilter bit promised the in-memory answer on every operator but
text ordering, which was measured on SQLite and PostgreSQL 16 only. Text
equality and membership also follow a case- or accent-insensitive collation,
as the same datasource's where does; the TSDoc, the describe and the
changeset now say so and name MySQL and SQL Server as not measured. The
changeset's kind line becomes semantic: a stored having or measure filter
keeps validating and now matches other rows under the NULL rule. The query
syntax page drops a row that listed the per-measure filter as not enforced.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5nSNBMzF8jj9quUkjf
Copy file name to clipboardExpand all lines: .changeset/33698-measure-filter-pushdown.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,9 @@
8
8
feat(spec, objectql, driver-sql, driver-turso): a per-measure aggregation filter runs in SQL on driver-sql, behind one declared driver capability (#33698)
9
9
10
10
Clause-②: yes (widening: one optional DriverCapabilities bit)
11
-
Metadata-protocol: added
11
+
Metadata-protocol: semantic
12
12
13
-
**The capability.**`DriverCapabilities` (`@objectstack/spec/data`) gains one optional boolean, `aggregationFilter`: the driver's `aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the answers the engine's in-memory aggregation gives. Absence means `false`. A driver that declares nothing keeps exactly the path it had.
13
+
**The capability.**`DriverCapabilities` (`@objectstack/spec/data`) gains one optional boolean, `aggregationFilter`: the driver's `aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the answers the engine's in-memory aggregation gives, except that text compares by the database collation (see the last paragraph). Absence means `false`. A driver that declares nothing keeps exactly the path it had.
14
14
15
15
**What runs where.**
16
16
@@ -23,4 +23,4 @@ Metadata-protocol: added
23
23
24
24
**A measure filter the `where` compiler refuses now refuses on driver-sql.** Because driver-sql compiles a measure filter with the same where compiler, a filter that compiler refuses answers the same `400 INVALID_FILTER` its `where` twin answers. The recorded case is a `{ $field }` comparison between columns of different classes on an object with no audit fields (`created_at` against an image field): before, the engine evaluated it in memory and answered `200`; on driver-sql it now answers `400 INVALID_FILTER`, as `where` always did. A driver without the bit still evaluates it in memory and answers `200`.
25
25
26
-
**Declared latitude.** Ordering a non-temporal text column (`$gt` / `$lt` / `$between` on text) follows the database collation, as it always has for a `where`. On a database whose collation is not code-point order (measured: PostgreSQL with an ICU `en-US` collation), such a measure filter can select other rows in SQL than in memory. Every other operator agreed on SQLite and PostgreSQL 16. MySQL was not measured.
26
+
**Declared latitude: text compares by the database collation.**On driver-sql a measure filter now answers what the `where` of the same datasource answers, so text comparison in it follows the database collation, where the in-memory path compares text exactly. Ordering a non-temporal text column (`$gt` / `$lt` / `$between` on text) follows the collation everywhere; on a case- or accent-insensitive collation, equality and membership do too, so `stage $eq 'won'` also counts `Won` rows, as `where` already does. Measured: SQLite and PostgreSQL 16 agree with the in-memory path on every operator with a `C.UTF-8` collation; PostgreSQL 16 with an ICU `en-US` collation differs only in text ordering. MySQL and SQL Server were not measured; their default collations are case-insensitive.
Copy file name to clipboardExpand all lines: content/docs/protocol/objectql/query-syntax.mdx
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,6 @@ on the `find()` path:
90
90
91
91
| Member | Status |
92
92
|:-------|:-------|
93
-
|`aggregations[].filter`|`[EXPERIMENTAL — not enforced]` — a SQL `FILTER (WHERE …)` affordance neither the SQL builders nor the in-memory fallback applies |
94
93
|`search.fuzzy` / `boost` / `operator` / `minScore` / `language` / `highlight`|`[EXPERIMENTAL — not enforced]` — only `query` and `fields` drive the expansion |
95
94
96
95
`top` is the exception that *is* honored — the engine normalises it to `limit`.
|**transactionsUnsupported**|`boolean`| optional | Transport cannot honour transactions even though `beginTransaction` is inherited (absence = false) |
168
-
|**aggregationFilter**|`boolean`| optional |`aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the engine's in-memory answer (absence = false: the engine aggregates filtered measures in memory) |
168
+
|**aggregationFilter**|`boolean`| optional |`aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the engine's in-memory answer, except that text compares by the backend collation as in `where` (absence = false: the engine aggregates filtered measures in memory) |
169
169
|**create**|`never`| optional |[REMOVED]`DriverCapabilities.create` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: `create`/`find`/`findOne`/`update`/`delete` are REQUIRED `IDataDriver` methods and the engine calls them unconditionally. Delete the key. |
170
170
|**read**|`never`| optional |[REMOVED]`DriverCapabilities.read` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: reads go through the REQUIRED `find`/`findOne`/`count` methods, called unconditionally. Delete the key. |
171
171
|**update**|`never`| optional |[REMOVED]`DriverCapabilities.update` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: `update`/`upsert` are REQUIRED `IDataDriver` methods, called unconditionally. Delete the key. |
|**transactionsUnsupported**|`boolean`| optional | Transport cannot honour transactions even though `beginTransaction` is inherited (absence = false) |
81
-
|**aggregationFilter**|`boolean`| optional |`aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the engine's in-memory answer (absence = false: the engine aggregates filtered measures in memory) |
81
+
|**aggregationFilter**|`boolean`| optional |`aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the engine's in-memory answer, except that text compares by the backend collation as in `where` (absence = false: the engine aggregates filtered measures in memory) |
82
82
|**create**|`never`| optional |[REMOVED]`DriverCapabilities.create` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: `create`/`find`/`findOne`/`update`/`delete` are REQUIRED `IDataDriver` methods and the engine calls them unconditionally. Delete the key. |
83
83
|**read**|`never`| optional |[REMOVED]`DriverCapabilities.read` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: reads go through the REQUIRED `find`/`findOne`/`count` methods, called unconditionally. Delete the key. |
84
84
|**update**|`never`| optional |[REMOVED]`DriverCapabilities.update` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: `update`/`upsert` are REQUIRED `IDataDriver` methods, called unconditionally. Delete the key. |
|**transactionsUnsupported**|`boolean`| optional | Transport cannot honour transactions even though `beginTransaction` is inherited (absence = false) |
35
-
|**aggregationFilter**|`boolean`| optional |`aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the engine's in-memory answer (absence = false: the engine aggregates filtered measures in memory) |
35
+
|**aggregationFilter**|`boolean`| optional |`aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the engine's in-memory answer, except that text compares by the backend collation as in `where` (absence = false: the engine aggregates filtered measures in memory) |
36
36
|**create**|`never`| optional |[REMOVED]`DriverCapabilities.create` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: `create`/`find`/`findOne`/`update`/`delete` are REQUIRED `IDataDriver` methods and the engine calls them unconditionally. Delete the key. |
37
37
|**read**|`never`| optional |[REMOVED]`DriverCapabilities.read` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: reads go through the REQUIRED `find`/`findOne`/`count` methods, called unconditionally. Delete the key. |
38
38
|**update**|`never`| optional |[REMOVED]`DriverCapabilities.update` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: `update`/`upsert` are REQUIRED `IDataDriver` methods, called unconditionally. Delete the key. |
@@ -88,7 +88,7 @@ const result = DriverCapabilitiesSchema.parse(data);
|**transactionsUnsupported**|`boolean`| optional | Transport cannot honour transactions even though `beginTransaction` is inherited (absence = false) |
91
-
|**aggregationFilter**|`boolean`| optional |`aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the engine's in-memory answer (absence = false: the engine aggregates filtered measures in memory) |
91
+
|**aggregationFilter**|`boolean`| optional |`aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the engine's in-memory answer, except that text compares by the backend collation as in `where` (absence = false: the engine aggregates filtered measures in memory) |
92
92
|**create**|`never`| optional |[REMOVED]`DriverCapabilities.create` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: `create`/`find`/`findOne`/`update`/`delete` are REQUIRED `IDataDriver` methods and the engine calls them unconditionally. Delete the key. |
93
93
|**read**|`never`| optional |[REMOVED]`DriverCapabilities.read` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: reads go through the REQUIRED `find`/`findOne`/`count` methods, called unconditionally. Delete the key. |
94
94
|**update**|`never`| optional |[REMOVED]`DriverCapabilities.update` was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: `update`/`upsert` are REQUIRED `IDataDriver` methods, called unconditionally. Delete the key. |
* Optional; absence means `false`, like `batchSchemaSync`.
325
337
*/
326
-
aggregationFilter: z.boolean().optional().describe('`aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the engine\'s in-memory answer (absence = false: the engine aggregates filtered measures in memory)'),
338
+
aggregationFilter: z.boolean().optional().describe('`aggregate()` evaluates a per-measure `aggregations[].filter` itself, with the engine\'s in-memory answer, except that text compares by the backend collation as in `where` (absence = false: the engine aggregates filtered measures in memory)'),
0 commit comments