Commit bdcb41d
committed
feat(driver-mongodb): lower dateGranularity groupBy to $dateToString bucket labels, and publish supports.queryDateGranularity (#7580)
`driver-mongodb` published no `queryDateGranularity`, so `engine.aggregate`
bucketed every granularity in memory: correct answers, but the whole result set
shipped to the client before the rollup. #7550 refused a bucketed node at the
builder rather than implement or silently drop it, and sized the native lowering
as a card of its own. This is that card.
The bucket LABELS are the engine's own spellings, because the engine picks
between the pushed-down and in-memory paths per query and a drill-down can cross
that seam. All five declared granularities are advertised — `week` included,
where driver-sql on SQLite cannot, because `$dateToString` has both halves of
the ISO-8601 week date (`%G`/`%V`).
No `$dateTrunc`: it answers a truncated DATE that still needs formatting, raises
the server floor to MongoDB 5.0, and adds binSize/startOfWeek semantics this
fleet cannot observe. `$dateToString` answers the label directly out of one
operator, and fewer unobserved operators is the whole argument.
All three ADR-0053 storage forms are served through one total expression:
`$convert … onError/onNull: null` mirrors `bucketDateValue`'s totality, so a
BSON Date, `YYYY-MM-DD` text, `HH:MM:SS` text, null, missing and unparseable
junk all bucket the way the engine buckets them.
The capability record and the builder's refusal read ONE constant, so an
advertised granularity the builder would refuse cannot exist — the failure worse
than advertising nothing, since the engine stops bucketing in memory on the
strength of the bit.
Parity is proven by running the SAME rows through the real
`applyInMemoryAggregation` and through the emitted pipeline. driver-mongodb can
depend on objectql where driver-sql cannot (objectql depends on no driver), so
this is a devDependency rather than the hand-copied `bucketDateValue` the three
SQL bucket suites carry, and the drift their `1 parent 34c01a5 commit bdcb41d
9 files changed
Lines changed: 1220 additions & 259 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
0 commit comments