feat(bindings): extend extent(*) to spanset and set surfaces#48
Closed
estebanzimanyi wants to merge 1 commit into
Closed
feat(bindings): extend extent(*) to spanset and set surfaces#48estebanzimanyi wants to merge 1 commit into
estebanzimanyi wants to merge 1 commit into
Conversation
Adds 10 new aggregate overloads to the existing extent() set:
- extent(<spanset>) -> <span> for int/bigint/float/date/tstzspanset
- extent(<set>) -> <span> for int/bigint/float/date/tstzset
(textset has no span equivalent)
Each new functor (SpansetExtentFunction, SetExtentFunction) reuses the
shared SpanExtentState (Span span + bool isset) and the shared
Initialize / Combine / Finalize via SpanExtentBase. Operation dispatches
to the corresponding MEOS transfn:
- spanset_extent_transfn(state, ss)
- set_extent_transfn(state, s)
These return a palloc'd Span* on first call (NULL state) which we
memcpy-into-state-and-free, then expand the inline state in place on
subsequent calls — same convention as the original SpanExtentFunction.
This was referenced Apr 29, 2026
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds 10 new aggregate overloads to the `extent()` set introduced in #47:
```sql
SELECT extent(s) FROM (VALUES (intspanset '{[1, 3), [5, 7)}'), (intspanset '{[10, 12)}')) t(s);
-- [1, 12)
SELECT extent(s) FROM (VALUES (intset '{1, 3, 5}'), (intset '{10, 20}')) t(s);
-- [1, 21)
SELECT extent(s) FROM (VALUES (datespanset '{[2000-01-01, 2000-01-03)}'), (datespanset '{[2000-01-05, 2000-01-10)}')) t(s);
-- [2000-01-01, 2000-01-10)
```
Implementation
Adds `SpansetExtentFunction` and `SetExtentFunction` functors. Both reuse the shared `SpanExtentState` (`Span span + bool isset`) and `SpanExtentBase` (Initialize / Combine / Finalize). Only `Operation` differs — it dispatches to the corresponding MEOS transfn:
These return a palloc'd `Span*` on first call (when state is NULL); the wrapper memcpy-into-state-and-frees, then expands the inline state in place on subsequent calls — same convention as the original `SpanExtentFunction`.
Stacked on
Test plan