Skip to content

feat(bindings): extend extent() aggregate across all fixed-state inputs#86

Closed
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-aggregates-extent
Closed

feat(bindings): extend extent() aggregate across all fixed-state inputs#86
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-aggregates-extent

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Summary

Builds on PR #b8efad4 (extent for the 5 span types) and adds 15 more overloads to the same `extent` aggregate set, covering everything in the MobilityDB `extent(...)` family that has fixed-size aggregate state.

Category Inputs Returns
Numeric scalars integer, bigint, double, date, timestamptz typed span (intspan / bigintspan / floatspan / datespan / tstzspan)
Sets intset, bigintset, floatset, dateset, tstzset typed span
Spansets intspanset, bigintspanset, floatspanset, datespanset, tstzspanset typed span
Boxes tbox, stbox same box type
Temporal numbers tint, tfloat tbox
Temporal others tbool, ttext tstzspan
Temporal point tgeompoint stbox

All variants share three small templated state types (`Span`, `TBox`, `STBox`) and dispatch on the appropriate MEOS `*_extent_transfn` for each input shape. Combine functions use `span_extent_transfn` / `tbox_expand` / `stbox_expand` so parallel-aggregate merge is correct.

Out of scope (next aggregate PRs)

The remaining MobilityDB aggregates need a SkipList-based variable-size state (currently outside MobilityDuck's aggregate-state machinery): `merge`, `appendInstant`, `appendSequence`, `tcount`, `tmin`, `tmax`, `tsum`, `tavg`, `tand`, `tor`, `tcentroid`, `spanUnion`, `setUnion`, and the window aggregates `wmin` / `wmax` / `wsum` / `wcount` / `wavg`. They will get their own PR(s) once the SkipList serializer is in place.

Test plan

  • `test/sql/parity/030_aggregates_extent.test` — 20 assertions across all categories plus NULL handling.
  • No regression in the existing `001_set.test` and `025_temporal_tile_getters.test`.

🤖 Generated with Claude Code

Previous PR landed extent() for the 5 span types only. This expands
the same aggregate to cover the full MobilityDB SQL surface for fixed-
size-state extent variants (still avoiding the SkipList-state aggregates
like tcount / tmin / tcentroid / merge / appendInstant — those need a
larger lift).

Added (15 new overloads on the same `extent` aggregate set):

- extent(integer | bigint | double | date | timestamptz)  -> typed span
- extent(intset | bigintset | floatset | dateset | tstzset) -> typed span
- extent(intspanset | bigintspanset | floatspanset
        | datespanset | tstzspanset)                       -> typed span
- extent(tbox)                                              -> tbox
- extent(stbox)                                             -> stbox
- extent(tint | tfloat)                                     -> tbox
- extent(tbool | ttext)                                     -> tstzspan
- extent(tgeompoint)                                        -> stbox

All variants share a small set of templated state types — Span, TBox,
STBox — and dispatch on the appropriate MEOS *_extent_transfn for the
input. Combine functions use span_extent_transfn / tbox_expand /
stbox_expand so parallel-agg merge works.

Tests in 030_aggregates_extent.test cover one assertion per category
plus NULL handling.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@estebanzimanyi
Copy link
Copy Markdown
Member Author

Superseded by the consolidated PR branch consolidate/aggregates-parity. All changes from this PR are included in that branch as a single squashed commit. Please review and merge the consolidated branch instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant