feat(bindings): tagg_min(ttext) / tagg_max(ttext) overloads#54
Closed
estebanzimanyi wants to merge 1 commit into
Closed
feat(bindings): tagg_min(ttext) / tagg_max(ttext) overloads#54estebanzimanyi wants to merge 1 commit into
estebanzimanyi wants to merge 1 commit into
Conversation
Adds the ttext branch of the temporal min/max aggregates that the prior PR explicitly skipped (ttext merge needs text_cmp plumbing). MEOS exports text_cmp as a public API, so the wrapper datum_min_text / datum_max_text equivalents are simple two-line functions. Each merge fn casts both Datums to text* (PG varlena) and invokes text_cmp; the result selects which Datum to return. tagg_min picks the smaller, tagg_max the larger.
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 the ttext branch of the temporal min/max aggregates that PR #52 explicitly skipped ("ttext skipped — text merge needs text_cmp plumbing"). MEOS exports `text_cmp` as a public API, so the wrapper datum-merge functions are 2-liners:
```cpp
static Datum mduck_datum_min_text(Datum l, Datum r) {
return text_cmp((text*)l, (text*)r) < 0 ? l : r;
}
```
Each merge fn casts both Datums to `text*` (PG varlena), invokes `text_cmp`, and returns whichever Datum the comparison selects.
Coverage
```sql
SELECT tagg_min(t) FROM (VALUES (ttext '"hello"@2000-01-01'), (ttext '"alpha"@2000-01-01')) tt(t);
-- {"alpha"@2000-01-01 00:00:00+00}
SELECT tagg_max(t) FROM (VALUES (ttext '"hello"@2000-01-01'), (ttext '"zebra"@2000-01-01')) tt(t);
-- {"zebra"@2000-01-01 00:00:00+00}
```
Stacked on
Test plan