Skip to content

feat(bindings): ever/always ordering (lt, le, gt, ge) — named functions#35

Closed
estebanzimanyi wants to merge 1 commit into
feat/temporal-everalways-eq-nefrom
feat/temporal-everalways-ord
Closed

feat(bindings): ever/always ordering (lt, le, gt, ge) — named functions#35
estebanzimanyi wants to merge 1 commit into
feat/temporal-everalways-eq-nefrom
feat/temporal-everalways-ord

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Summary

Adds 48 ScalarFunction registrations covering the temporal-comparison ever/always ordering surface for tint / tfloat (no tbool — booleans have no ordering).

Functions Variants
ever_lt, always_lt, ever_le, always_le, ever_gt, always_gt, ever_ge, always_ge value op temporal, temporal op value, temporal op temporal × {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.

Implementation

Smoke test

SELECT ever_lt(tint '[1@01-01, 5@01-05]', 3);                 -- true
SELECT always_lt(tint '[1@01-01, 2@01-02]', 3);               -- true
SELECT ever_le(0, tint '[1@01-01, 2@01-02]');                 -- true
SELECT always_ge(tint '[5@01-01, 10@01-05]', 5);              -- true
SELECT ever_gt(tfloat '[1.5@01-01, 2.5@01-02]', 2.0::DOUBLE); -- true

Test plan

Dependencies

Stacked on PR #34 (ever/always eq+ne). Merge order: #27#29#30#31#32#33#34 → this.

Adds 48 ScalarFunction registrations covering the temporal-comparison
ever/always ordering surface for tint / tfloat (no tbool — booleans
have no ordering):

  ever_lt, always_lt, ever_le, always_le,
  ever_gt, always_gt, ever_ge, always_ge
    × value op temporal, temporal op value, temporal op temporal
    × {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 40 wrapper functions (8 named functions × 5 type-pair
shapes) generated via a DEFINE_EA_ORD_OP macro, reusing the
EverAlwaysValTemp / EverAlwaysTempVal / EverAlwaysTempTemp helpers
from the eq+ne PR.

Smoke test:
  SELECT ever_lt(tint '[1@01-01, 5@01-05]', 3);                 -- true
  SELECT always_lt(tint '[1@01-01, 2@01-02]', 3);               -- true
  SELECT ever_le(0, tint '[1@01-01, 2@01-02]');                 -- true
  SELECT always_ge(tint '[5@01-01, 10@01-05]', 5);              -- true
  SELECT ever_gt(tfloat '[1.5@01-01, 2.5@01-02]', 2.0::DOUBLE); -- true

Stacked on PR #34 (ever/always eq+ne).

Full suite passes (747 assertions, 13 test cases).
estebanzimanyi added a commit that referenced this pull request Apr 25, 2026
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

Copy link
Copy Markdown
Member Author

Consolidated into #41 (ever/always comparison predicates — eq/ne/ord combined).

estebanzimanyi added a commit that referenced this pull request Apr 25, 2026
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 added a commit that referenced this pull request Apr 25, 2026
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 added a commit that referenced this pull request Apr 27, 2026
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).
nhungoc1508 pushed a commit that referenced this pull request Apr 27, 2026
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).
nhungoc1508 pushed a commit that referenced this pull request Apr 27, 2026
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).
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