Skip to content

feat(bindings): ever/always comparison predicates (eq, ne, lt, le, gt, ge)#41

Closed
estebanzimanyi wants to merge 2 commits intofeat/temporal-time-domain-predicatesfrom
feat/temporal-everalways-comparisons
Closed

feat(bindings): ever/always comparison predicates (eq, ne, lt, le, gt, ge)#41
estebanzimanyi wants to merge 2 commits intofeat/temporal-time-domain-predicatesfrom
feat/temporal-everalways-comparisons

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Summary

Combines ever/always equality, inequality, and ordering predicates between Temporal values and base scalars across all 6 comparison ops × applicable base types. 232 lines, all routed through the EverAlwaysValTemp<T> templated helper.

This PR consolidates two previously stacked PRs covering the same surface across the same template — splitting eq/ne from ord added review burden without giving reviewers any independent decision points.

Coverage

Predicate Naming convention
Equality ever_eq(t, v), always_eq(t, v), ever_ne(t, v), always_ne(t, v)
Ordering ever_lt, always_lt, ever_le, always_le, ever_gt, always_gt, ever_ge, always_ge

Functions are exposed as named SQL forms because DuckDB's parser does not accept the MobilityDB ?=, %=, ?<, %<, etc. operator forms.

Test plan

  • All registrations load
  • Smoke tests for each predicate against representative base types
  • Full local suite passes net of pre-existing TZ-environment failures

Replaces

@estebanzimanyi estebanzimanyi force-pushed the feat/temporal-everalways-comparisons branch from 4dbe1cc to fed1b76 Compare April 25, 2026 15:07
@estebanzimanyi estebanzimanyi changed the base branch from feat/temporal-posops to feat/temporal-time-domain-predicates April 25, 2026 15:08
@estebanzimanyi estebanzimanyi force-pushed the feat/temporal-time-domain-predicates branch from c4513da to cf03319 Compare April 25, 2026 15:16
@estebanzimanyi estebanzimanyi force-pushed the feat/temporal-everalways-comparisons branch from fed1b76 to daf649a Compare April 25, 2026 15:16
@estebanzimanyi estebanzimanyi force-pushed the feat/temporal-time-domain-predicates branch from cf03319 to 152ec24 Compare April 27, 2026 12:55
…, ge)

Adds ever/always comparison predicates between Temporal values and base
scalars across all 6 comparison ops × 6 base types (int, bigint, float,
text, geometry, geography where applicable).

Uses the EverAlwaysValTemp<T> templated helper. Functions are exposed as
named SQL forms (`ever_eq`, `always_eq`, `ever_ne`, `always_ne`,
`ever_lt`, `always_lt`, `ever_le`, `always_le`, `ever_gt`, `always_gt`,
`ever_ge`, `always_ge`) — DuckDB's parser does not accept the MobilityDB
`?=`, `%=`, `?<`, `%<`, etc. operator forms.
@estebanzimanyi estebanzimanyi force-pushed the feat/temporal-everalways-comparisons branch from daf649a to 070e31a Compare April 27, 2026 12:55
Adds 8 ScalarFunction registrations for temporal similarity:

  frechetDistance(t1, t2)      -> DOUBLE
  discreteFrechet(t1, t2)      -> DOUBLE  (alias of frechetDistance)
  dynTimeWarp(t1, t2)          -> DOUBLE
  hausdorffDistance(t1, t2)    -> DOUBLE

For each: (tint, tint) and (tfloat, tfloat) registrations.

MEOS bindings:
  temporal_frechet_distance, temporal_dyntimewarp_distance,
  temporal_hausdorff_distance.

Implementation uses 3 thin wrappers + a single TempTempDoublePred
templated helper.

similarityPath (table-returning, alignment) is intentionally NOT
included — needs DuckDB TableFunction infrastructure (separate
follow-up tracked in PR #23).

Smoke test:
  SELECT frechetDistance(tfloat '[1@01-01, 2@01-02]', tfloat '[2@01-01, 3@01-02]');     -- 1.0
  SELECT discreteFrechet(tfloat '[1@01-01, 2@01-02]', tfloat '[2@01-01, 3@01-02]');     -- 1.0
  SELECT dynTimeWarp(tfloat '[1@01-01, 2@01-02]', tfloat '[2@01-01, 3@01-02]');         -- 2.0
  SELECT hausdorffDistance(tfloat '[1@01-01, 5@01-05]', tfloat '[3@01-01, 3@01-05]');   -- 2.0

Stacked on PR #35 (ever/always ordering).

Full suite passes (747 assertions, 13 test cases).
@estebanzimanyi estebanzimanyi changed the base branch from feat/temporal-time-domain-predicates to main April 27, 2026 13:25
@estebanzimanyi estebanzimanyi changed the base branch from main to feat/temporal-time-domain-predicates April 27, 2026 13:26
@estebanzimanyi
Copy link
Copy Markdown
Member Author

@nhungoc1508 — quick note for review: this branch now carries two PRs' worth of content stacked:

When you squash-merge this PR into main, both commits will be combined into a single squashed commit on main. That's functionally correct — both PRs' code reaches main — but the combined commit is ~278 lines (232 from #41 + 46 from #36).

For future PRs in the binding stack, please update each PR's base to main before merging (gh pr edit <N> --base main) — that keeps each squash-merge clean.

@estebanzimanyi
Copy link
Copy Markdown
Member Author

Superseded — content landed in main as commit 83e2daa when PR #39 was merged with base=main (which brought the entire stack along). This PR's branch is now behind main and merging it would delete code, so closing.

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