feat(bindings): tnumber distance — <->, nad, nearestApproachDistance#31
Closed
estebanzimanyi wants to merge 1 commit into
Closed
feat(bindings): tnumber distance — <->, nad, nearestApproachDistance#31estebanzimanyi wants to merge 1 commit into
estebanzimanyi wants to merge 1 commit into
Conversation
…tApproachDistance Adds 10 ScalarFunction registrations: tint <-> tint -> tint (MEOS: tdistance_tnumber_tnumber) tfloat <-> tfloat -> tfloat nad(tint, INTEGER) -> INTEGER (MEOS: nad_tint_int) nad(tint, tint) -> INTEGER (MEOS: nad_tint_tint) nad(tfloat, DOUBLE) -> DOUBLE (MEOS: nad_tfloat_float) nad(tfloat, tfloat) -> DOUBLE (MEOS: nad_tfloat_tfloat) nearestApproachDistance(...) -> ... (4 aliases for the nad set) Implementation uses templated helpers from PR #27 plus per-call BinaryExecutor blocks for the scalar-returning nad variants. Value-distance variants `<->` for (tint, INTEGER) / (INTEGER, tint) / (tfloat, DOUBLE) / (DOUBLE, tfloat) are intentionally NOT registered: in the installed MEOS library, tdistance_tfloat_float / tint_int return the temporal's own value at each instant rather than the |t.value - v| absolute difference. Smoke verified: SELECT 5.0::DOUBLE <-> tfloat '5.0@2000-01-01'; -> 5.0 (expected 0.0) SELECT 100.0::DOUBLE <-> tfloat '2.5@2000-01-01'; -> 2.5 (expected 97.5) The Tdistance_*_value/Tdistance_value_* implementations stay in the header and .cpp so the registrations can be uncommented in src/temporal/temporal.cpp once the MEOS upstream is fixed. Smoke (working): SELECT tfloat '[1@01-01, 5@01-05]' <-> tfloat '[3@01-01, 3@01-05]'; -> [2@01-01, 0@01-03, 2@01-05] SELECT nad(tint '[1@01-01, 5@01-05]', 3); -> 0 SELECT nad(tfloat '[1@01-01, 5@01-05]', tfloat '[3@01-01, 3@01-05]'); -> 0.0 Stacked on PR #30 (tnumber unary). Full suite passes (747 assertions, 13 test cases).
This was referenced Apr 25, 2026
Member
Author
|
Consolidated into #43 (tnumber numeric functions — arithmetic + unary + distance). |
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 10 ScalarFunction registrations for
tnumberdistance:tint <-> tinttdistance_tnumber_tnumbertinttfloat <-> tfloattdistance_tnumber_tnumbertfloatnad(tint, INTEGER)nad_tint_intINTEGERnad(tint, tint)nad_tint_tintINTEGERnad(tfloat, DOUBLE)nad_tfloat_floatDOUBLEnad(tfloat, tfloat)nad_tfloat_tfloatDOUBLEnearestApproachDistance(...)Implementation uses templated helpers from PR #27 plus per-call
BinaryExecutorblocks for the scalar-returningnadvariants.Intentionally NOT registered (documented MEOS-side issue)
Value-distance variants
<->for(tint, INTEGER)/(INTEGER, tint)/(tfloat, DOUBLE)/(DOUBLE, tfloat). In the installed MEOS library,tdistance_tfloat_float/tdistance_tint_intreturn the temporal's own value at each instant rather than the|t.value - v|absolute difference. Smoke verified:The wrapper implementations stay in the header and .cpp so the registrations can be uncommented in
src/temporal/temporal.cpponce the MEOS upstream is fixed.Smoke test (working surface)
Test plan
make releasethenTZ=UTC ./build/release/test/unittest "<proj>/test/*"— full suite passes.036_tnumber_distance.testskip block partially unwraps (the temporal-temporal andnad/nearestApproachDistancequeries become active; the value-temporal<->queries stay skipped pending MEOS fix).Dependencies
Stacked on PR #30 (tnumber unary). Merge order: #27 → #29 → #30 → this.