feat(bindings): tspatial direction predicates (above/below/front/back/left/right + over* variants)#39
Merged
Conversation
b9481c8 to
503f913
Compare
a0d024f to
c74c29c
Compare
503f913 to
76cf4da
Compare
c74c29c to
546fd1b
Compare
76cf4da to
c1a429a
Compare
546fd1b to
d4095f2
Compare
c1a429a to
f7345ea
Compare
Combines the tnumber numeric surface:
- Arithmetic operators: +, -, *, / for {tint, tfloat} × {scalar, tnumber}
(24 registrations) using TemporalBinaryV<T> dispatch
- Unary functions: abs, derivative, degrees, radians (12 registrations)
using TemporalUnary
- Distance: <-> for tnumber × tnumber and nad / nearestApproachDistance
named functions
Each function family routes through one of the existing templated
helpers so each ScalarFunction body is a single-line lambda calling
the corresponding MEOS *_tnumber_tnumber / arithop_tnumber_number
entrypoint.
Combines temporal × {Temporal, tstzspan, tstzspanset, timestamptz} time-
domain predicates:
- Topological: @>, <@, &&, -|- (96 registrations across all temporal
base types and time-shape pairs)
- Time-position: before, after, overbefore, overafter (named functions)
All wrappers route through TempTempBoolPred / TempBoxBoolPred<Span> /
BoxTempBoolPred<Span> with single-line lambdas dispatching to MEOS
*_temporal_temporal / *_tstzspan_temporal / *_temporal_tstzspan etc.
…, 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.
d4095f2 to
dbfa16e
Compare
f7345ea to
770b899
Compare
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).
Combines topological (@>, <@, &&, -|-) and position (<<, >>, &<, &>) predicates between tnumber and numspan/tbox, plus tnumber × tnumber variants. Adds 96 topological + 40 position registrations using shared TempBoxBoolPred<Span|TBox> / BoxTempBoolPred<Span|TBox> / TempTempBoolPred helpers and DEFINE_NUMSPAN_*/DEFINE_TBOX_*/DEFINE_TNUM_* generation macros.
dbfa16e to
55250f4
Compare
… pairs)
Adds ScalarFunction registrations for tgeompoint × {STBox, tgeompoint}
direction predicates wrapping MEOS *_tspatial_stbox / *_stbox_tspatial /
*_tspatial_tspatial. 36 registrations total:
- left/right/overleft/overright as <<, >>, &<, &> operators
- above/below/front/back/overabove/overbelow/overfront/overback as
named functions (DuckDB parser rejects |>>, <<|, &</, /&> et al.)
Above/below operate on Y; left/right on X; front/back on Z (require
3D points or STBox with Z dimension).
770b899 to
3343ad5
Compare
This was referenced Apr 27, 2026
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 ScalarFunction registrations for tgeompoint × {STBox, tgeompoint} direction predicates wrapping MEOS
*_tspatial_stbox/*_stbox_tspatial/*_tspatial_tspatial. 36 registrations total (12 directions × 3 type-pair shapes).<</>>&</&>above(...)/below(...)front(...)/back(...)overabove(...)/overbelow(...)overfront(...)/overback(...)The above/below/front/back operators in MobilityDB (
|>>,<<|,<</,/>>,&</,/&>, etc.) contain|and/characters that DuckDB's parser does not accept inside operator names, so those use named functions instead.Each direction emits 3 wrappers via
DEFINE_TSPATIAL_STBOX_POS(name, meos_fn):name##_tspatial_stboxname##_stbox_tspatialname##_tspatial_tspatialThese reuse the existing
TempBoxBoolPred<STBox>/BoxTempBoolPred<STBox>/TempTempBoolPredhelpers —STBoxblob layout matches the templatedBox*malloc/memcpy path used forTBox.Semantics
above/belowoperate on the Y axisleft/righton the X axisfront/backon the Z axis (require 3DPoint Z(x y z)orSTBox Z(...))Test plan