Skip to content

Commit f650119

Browse files
ampagenttmm
andcommitted
fix(zero-swift): fail min/max of values JS can't compare
min or max of a json column without a path compared objects through ValueCompare's total order, while JS's hydration throws "Unsupported type: object". compareAggregateValues now reports JS's error as a pipeline failure, so the query fails as in JS instead of returning a value. Adds the bug hunt's IVM vectors (bughunt-ivm) and BugHuntTests. Co-authored-by: tmm <tmm@tmm.dev> Amp-Thread-ID: https://ampcode.com/threads/T-01a19a37-5aa9-7256-bff5-cdc47c01a1fe
1 parent 2f1101e commit f650119

7 files changed

Lines changed: 794 additions & 6 deletions

File tree

‎.changeset/swift-ivm-aggregates.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
'zero-swift': minor
33
---
44

5-
Queries can compute aggregates, `distinct()` and `groupBy()` on the client, with the IVM operators of the JS client (`Aggregate`, `GroupBy`, `GroupProjection` and `LiftField`), kept up to date as rows change. The untyped builder has `count()`, `sum`, `avg`, `min` and `max` (of a column, or of a value at a JSON path: `sum(json: "metadata", "points")`), `distinct(...)`, and `groupBy(...)` followed by an aggregate, with the JS builder's checks. On a query the view holds the value; in `related(...)` the relationship does, for a junction relationship too.
5+
Queries can compute aggregates, `distinct()` and `groupBy()` on the client, with the IVM operators of the JS client (`Aggregate`, `GroupBy`, `GroupProjection` and `LiftField`), kept up to date as rows change. The untyped builder has `count()`, `sum`, `avg`, `min` and `max` (of a column, or of a value at a JSON path: `sum(json: "metadata", "points")`), `distinct(...)`, and `groupBy(...)` followed by an aggregate, with the JS builder's checks. On a query the view holds the value; in `related(...)` the relationship does, for a junction relationship too. `min` or `max` of values JS can't compare, such as a json column without a path, fails the query with JS's error.
66

77
Breaking: `ViewValue` has a new case, `.value`, an aggregate's value; an exhaustive `switch` over it needs one too.

0 commit comments

Comments
 (0)