Skip to content

feat(bindings): tspatial topological predicates — operators + named aliases#75

Closed
estebanzimanyi wants to merge 1 commit into
mainfrom
feat/parity-tspatial-topops
Closed

feat(bindings): tspatial topological predicates — operators + named aliases#75
estebanzimanyi wants to merge 1 commit into
mainfrom
feat/parity-tspatial-topops

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Adds the 5 topological predicates across the `tspatial × {stbox, tspatial}` surface that previously had no handlers in MobilityDuck.

New SQL surface

Five predicates: `contains` / `contained` / `overlaps` / `same` / `adjacent`. Each is registered both as the operator form and as the MobilityDB-canonical named-function alias.

Operator Alias
`@>` `temporal_contains`
`<@` `temporal_contained`
`&&` `temporal_overlaps`
`~=` `temporal_same`
`- -`

Coverage:

  • `tgeompoint × stbox`
  • `stbox × tgeompoint`
  • `tgeompoint × tgeompoint`

That's 5 ops × 2 names × 3 type-pairs = 30 new registrations plus 15 new handler functions.

Implementation

Three new handler families per op, each calling the matching MEOS export (`contains_tspatial_stbox` / `contains_stbox_tspatial` / `contains_tspatial_tspatial`, ditto for contained/overlaps/same/adjacent). A `DEFINE_TSPATIAL_TOPO` macro in `stbox_functions.cpp` factors the boilerplate; a parallel `REG_TSPATIAL_TOPO` macro in `stbox.cpp` emits the operator + named-alias pair for each `(L, R, FN_SUFFIX)` triple.

Closes the temporal_same gap

PR #72 (`temporal/032_temporal_boxops`) deferred `temporal_same` because the underlying `Same_*` handler family wasn't wired. This PR adds them on the tspatial side. The `stbox × stbox` `=` operator was already wired (with `Same_stbox_stbox`); the `temporal × temporal` and `tnumber × {numspan, tbox}` `=` cases stay deferred — separate small follow-up.

Tests

  • `test/sql/parity/060_tspatial_topops.test` — 9 assertions covering each of the 5 ops in both directions plus operator-vs-alias equivalence.
  • Full suite: 761 assertions / 14 test cases passing under `TZ=UTC`.

Coverage delta

Per the audit in PR #66:

Test plan

  • `cmake --build . --target shell unittest` clean
  • New parity test passes (9/9)
  • Full suite green (761/14)

…liases

Adds 5 topological predicates across the tspatial × {stbox, tspatial}
surface, both as @>/<@/&&/~=/-|- operators and as MobilityDB-canonical
named-function aliases (temporal_contains/contained/overlaps/same/
adjacent).

New handlers in StboxFunctions (15 total):

- Contains/Contained/Overlaps/Same/Adjacent  _tspatial_stbox
- Contains/Contained/Overlaps/Same/Adjacent  _stbox_tspatial
- Contains/Contained/Overlaps/Same/Adjacent  _tspatial_tspatial

Each routes to the matching MEOS export
(contains_tspatial_stbox / contains_stbox_tspatial /
contains_tspatial_tspatial, etc.). A DEFINE_TSPATIAL_TOPO macro
factors the boilerplate.

Registered for tgeompoint × {stbox, tgeompoint}; a parallel REG_TSPATIAL_TOPO
macro in stbox.cpp emits the operator + named-alias pair for each
(L, R, FN_SUFFIX) triple. tgeometry overloads stay pending until the
wider tgeometry scalar surface lands.

Also closes the long-standing temporal_same gap: the Same handler now
exists for tspatial pairs, and the temporal/032_temporal_boxops PR #72
already documented the deferral. Once both lands, ~= / temporal_same
on stbox-stbox already works (existing wiring in stbox.cpp).

Test: test/sql/parity/060_tspatial_topops.test (9 assertions covering
each of the 5 ops in both directions plus operator-vs-alias
equivalence).
Full suite: 761 / 14 cases under TZ=UTC.

Files also gain a trailing newline at EOF.
@estebanzimanyi

Copy link
Copy Markdown
Member Author

Superseded by the consolidated PR branch consolidate/spatial-predicates-parity. All changes from this PR are included in that branch as a single squashed commit. Please review and merge the consolidated branch instead.

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