Skip to content

feat(bindings): temporal similarity measures (Frechet, DTW, Hausdorff)#36

Merged
nhungoc1508 merged 1 commit into
feat/temporal-everalways-comparisonsfrom
feat/temporal-similarity
Apr 27, 2026
Merged

feat(bindings): temporal similarity measures (Frechet, DTW, Hausdorff)#36
nhungoc1508 merged 1 commit into
feat/temporal-everalways-comparisonsfrom
feat/temporal-similarity

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Summary

Adds 8 ScalarFunction registrations for temporal similarity measures:

Function MEOS
frechetDistance(t1, t2) temporal_frechet_distance
discreteFrechet(t1, t2) temporal_frechet_distance (alias)
dynTimeWarp(t1, t2) temporal_dyntimewarp_distance
hausdorffDistance(t1, t2) temporal_hausdorff_distance

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

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

Test plan

Dependencies

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

@estebanzimanyi estebanzimanyi force-pushed the feat/temporal-similarity branch from 23be6de to 23672e8 Compare April 25, 2026 15:04
@estebanzimanyi estebanzimanyi changed the base branch from feat/temporal-everalways-ord to feat/temporal-everalways-comparisons April 25, 2026 15:05
@estebanzimanyi estebanzimanyi force-pushed the feat/temporal-everalways-comparisons branch from 4dbe1cc to fed1b76 Compare April 25, 2026 15:07
@estebanzimanyi estebanzimanyi force-pushed the feat/temporal-similarity branch from 23672e8 to f174c9c Compare April 25, 2026 15:07
@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-similarity branch from f174c9c to b2685bb Compare April 25, 2026 15:16
@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 force-pushed the feat/temporal-similarity branch from b2685bb to 3291822 Compare April 27, 2026 12:55
@nhungoc1508 nhungoc1508 merged commit 2cc6373 into feat/temporal-everalways-comparisons Apr 27, 2026
3 checks passed
@estebanzimanyi

Copy link
Copy Markdown
Member Author

@nhungoc1508 — heads up: this PR is marked merged but its content did not reach main. PR #36's base was feat/temporal-everalways-comparisons (PR #41's branch). The squash-merge added the squashed commit 2cc6373 to feat/temporal-everalways-comparisons rather than to main.

PR #41's branch now carries this commit. When PR #41 lands in main, its squash-merge will combine PR #41's own content with PR #36's content into a single commit. The functional code reaches main, but PR #36 will not appear as its own merge commit in main's history.

If you want a clean attribution: I can re-PR PR #36's content as a separate PR rooted on main, after PR #41 lands. Otherwise it's fine to let the combined squash carry both.

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.

2 participants