Combine aggregate columns per function instead of summing every one #20

Merged
benvin merged 4 commits from benvin/aggregate-combiners into main 2026-09-07 17:41:03 +10:00
Member

sumRows folded every numeric column by addition, correct only for count and sum: min/max returned a sum, avg an average of averages, and a to_string extract collapsed every row into one bucket.

  • Combines count and sum by adding, min and max by the extreme, on text columns as well as numeric
  • Rewrites an avg extract into an upstream sum and count and divides the totals, answering under the avg key
  • Refuses with 400 an extract naming one response column twice, which openvoxdb aliases as _2
  • Refuses a group_by naming a folded aggregate column
  • Stops forwarding limit/offset for a folded aggregate, paging after the merge
  • Treats to_string and jsonb_typeof as row functions that group rather than fold
  • Keys groups on every non-aggregate projected column
sumRows folded every numeric column by addition, correct only for count and sum: min/max returned a sum, avg an average of averages, and a to_string extract collapsed every row into one bucket. - Combines count and sum by adding, min and max by the extreme, on text columns as well as numeric - Rewrites an avg extract into an upstream sum and count and divides the totals, answering under the avg key - Refuses with 400 an extract naming one response column twice, which openvoxdb aliases as <name>_2 - Refuses a group_by naming a folded aggregate column - Stops forwarding limit/offset for a folded aggregate, paging after the merge - Treats to_string and jsonb_typeof as row functions that group rather than fold - Keys groups on every non-aggregate projected column
unkin-agent added 4 commits 2026-09-07 14:05:12 +10:00
sumRows folded every numeric column by addition, which is only correct
for count and sum, so min/max returned a sum, avg an average of
averages, and a to_string extract collapsed into one empty-key row.

- Combine count and sum by adding, min and max by the extreme, on text
  columns as well as numeric ones
- Rewrite an avg extract into an upstream sum and count and divide the
  totals, answering under the avg key the client asked for
- Refuse an aggregate pdbmux cannot merge with 400 naming the clash
- Treat to_string and jsonb_typeof as row functions that group rather
  than fold, and key groups on every non-aggregate projected column
- Give the e2e fixture per-node resource line numbers and titles whose
  extremes differ per backend
A repeated extract function names one response column twice, which openvoxdb
aliases as <name>_2: unknown to the merge spec, it froze at the first backend's
value. A limit pushed upstream truncated each backend's groups before the
cross-backend fold, so a group could be partly counted or missed.

- Refuses any extract projecting one response column twice, naming the clash
- Fetches every group and applies limit/offset after the fold
- Documents the float64 avg divergence from Postgres numeric
A group_by key that repeats a folded column made the column a grouping
key and an aggregate at once, and for avg it left the upstream query
grouping on a column the rewrite had removed, so the request failed as
an opaque 502.

- refuse a group_by field that names a folded aggregate or the avg column
- cover the function-then-field ordering of the existing clash check
Assert the route table and the per-function combiners compose
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
25d773ac60
An aggregate reaching a guarded route through the dispatch table folds each
column by its own operation, so max is a maximum rather than a blanket sum.
unkin-agent force-pushed benvin/aggregate-combiners from 9b122d6a0b to 25d773ac60 2026-09-07 14:05:12 +10:00 Compare
benvin merged commit 2ea4ba82c5 into main 2026-09-07 17:41:03 +10:00
benvin deleted branch benvin/aggregate-combiners 2026-09-07 17:41:04 +10:00
Sign in to join this conversation.