feat(bindings): ever/always equality and inequality (eq, ne) — named functions#34
Closed
estebanzimanyi wants to merge 1 commit intofeat/temporal-posopsfrom
Closed
feat(bindings): ever/always equality and inequality (eq, ne) — named functions#34estebanzimanyi wants to merge 1 commit intofeat/temporal-posopsfrom
estebanzimanyi wants to merge 1 commit intofeat/temporal-posopsfrom
Conversation
…functions
Adds 36 ScalarFunction registrations covering the temporal-comparison
ever/always surface for tbool / tint / tfloat:
ever_eq, always_eq, ever_ne, always_ne
× value op temporal, temporal op value, temporal op temporal
× {bool/tbool, int/tint, double/tfloat}
DuckDB's parser does not accept `?` or `#` as operator-name
characters, so the upstream MobilityDB operators `?=`, `?<>`, `#=`,
`#<>` are unreachable from SQL — these named functions provide
equivalent behaviour.
Backed by 28 wrapper functions (4 named functions × 7 type-pair
shapes) generated via a DEFINE_EA_OP macro that calls the matching
MEOS function (ever_eq_*, always_eq_*, ever_ne_*, always_ne_*).
Three small templated helpers added (EverAlwaysValTemp,
EverAlwaysTempVal, EverAlwaysTempTemp) — MEOS returns int (1/0/-1),
mapped to bool via `r > 0`.
ttext_text / text_ttext variants are intentionally NOT included
(would need PG-text encoding plumbing, separate follow-up).
Smoke test:
SELECT ever_eq(1, tint '[1@01-01, 2@01-02]'); -- true
SELECT always_eq(tint '[1@01-01, 1@01-02]', 1); -- true
SELECT ever_ne(tint '[1@01-01, 2@01-02]', 1); -- true
SELECT always_ne(tint '[1@01-01, 2@01-02]', 5); -- true
SELECT ever_eq(tbool '[t@01-01, f@01-02]', true); -- true
SELECT ever_eq(tfloat '[1.5@01-01, 2.5@01-02]', 2.0::DOUBLE); -- true
Stacked on PR #33 (temporal time-position predicates).
Full suite passes (747 assertions, 13 test cases).
This was referenced Apr 25, 2026
Member
Author
|
Consolidated into #41 (ever/always comparison predicates — eq/ne/ord combined). |
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 36 ScalarFunction registrations covering the temporal-comparison ever/always surface for
tbool/tint/tfloat:ever_eq,always_eq,ever_ne,always_neDuckDB's parser does not accept
?or#as operator-name characters, so the upstream MobilityDB operators?=,?<>,#=,#<>are unreachable from SQL — these named functions provide equivalent behaviour.Implementation
DEFINE_EA_OPmacro that calls the matching MEOS function.EverAlwaysValTemp,EverAlwaysTempVal,EverAlwaysTempTemp).int(1=true, 0=false, -1=null/error), mapped to bool viar > 0.Out of scope (follow-up)
ttext_text/text_ttextvariants (would need PG-text encoding plumbing)ever_lt,always_lt, etc.) — same shape; can extend theDEFINE_EA_OPmacroSmoke test
Test plan
make releasethenTZ=UTC ./build/release/test/unittest "<proj>/test/*"— full suite passes.030_temporal_compops.testskip block partially unwraps (the eq/ne queries become active when re-pointed from?=/#=toever_eq/always_eqetc.). Ordering ops stay separate follow-up.Dependencies
Stacked on PR #33 (temporal time-position predicates). Merge order: #27 → #29 → #30 → #31 → #32 → #33 → this.