feat(bindings): wmin / wmax / wsum window aggregates#56
Closed
estebanzimanyi wants to merge 1 commit into
Closed
Conversation
Adds sliding-window aggregates over tint and tfloat: wmin(tint, INTERVAL) -> tint min over each [t, t+interval] window wmin(tfloat, INTERVAL) -> tfloat wmax(tint, INTERVAL) -> tint wmax(tfloat, INTERVAL) -> tfloat wsum(tint, INTERVAL) -> tint wsum(tfloat, INTERVAL) -> tfloat Each input row contributes its temporal value plus the (constant) window-width interval; the aggregate emits a single temporal value whose values at each instant reflect the minimum / maximum / sum over the window centred on that instant. Implementation: WindowAggFunction<TRANSFN, MERGE_FN, CROSSINGS> binary aggregate over (Temporal blob, interval_t). The interval is converted to MEOS Interval via the existing time_util.hpp helper and forwarded to MEOS tint_w*_transfn / tfloat_w*_transfn. State, Combine, Finalize, and Destroy reuse the skiplist-backed pattern. wavg deferred — needs datum_sum_double2 which is a MEOS-internal struct (sum, count) not available through the public API.
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 6 sliding-window aggregate overloads over tint and tfloat:
```sql
SELECT wmin(t, INTERVAL '1 day') FROM (VALUES (tint '5@2000-01-01'), (tint '3@2000-01-02')) tt(t);
-- {[5@2000-01-01, 3@2000-01-02, 3@2000-01-03]}
```
Implementation
`WindowAggFunction<TRANSFN, MERGE_FN, CROSSINGS>` is a binary aggregate over (Temporal blob, `interval_t`). The interval is converted to MEOS `Interval` via the existing `time_util.hpp::IntervaltToInterval` helper and forwarded to MEOS `tint_w*_transfn` / `tfloat_w*_transfn`. State, Combine, Finalize, and Destroy reuse the skiplist-backed pattern.
Out of scope
`wavg` is not registered: its MEOS combine path needs `datum_sum_double2` which is a MEOS-internal struct (sum, count) layout not available through the public API. Adding it requires either an upstream MEOS export or a local reimplementation that depends on internal struct layout.
Test plan