Skip to content

feat(bindings): tspatial comparison predicates — ever/always + temporal_teq/tne#76

Closed
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-tspatial-compops
Closed

feat(bindings): tspatial comparison predicates — ever/always + temporal_teq/tne#76
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-tspatial-compops

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Closes 100% of `geo/054_tpoint_compops` by name. Implements the spatial comparison handlers that were previously declared as TODO in `TgeompointFunctions`.

New SQL surface

ever / always (returning bool)

Signature MEOS export
`ever_eq(geometry, tgeompoint)` `ever_eq_geo_tgeo`
`ever_eq(tgeompoint, geometry)` `ever_eq_tgeo_geo`
`ever_eq(tgeompoint, tgeompoint)` `ever_eq_tgeo_tgeo`
`always_eq` / `ever_ne` / `always_ne` same shape × 3 directions

12 ever/always registrations.

temporal_teq / temporal_tne (returning tbool)

Signature Notes
`temporal_teq(geometry, tgeompoint)` `teq_geo_tgeo`
`temporal_teq(tgeompoint, geometry)` `teq_tgeo_geo`
`temporal_teq(tgeompoint, tgeompoint)` `teq_temporal_temporal`
`temporal_tne` symmetric on `tne_*`

6 temporal_teq/tne registrations.

Implementation

Two macros (`DEFINE_EA_GEO_TGEO`, `DEFINE_TCMP_GEO_TGEO`) factor the boilerplate; each produces a 3-handler block (`_geo_tgeo`, `_tgeo_geo`, `*_tgeo_tgeo`). The (tgeo, tgeo) variant reuses MEOS `teq_temporal_temporal` / `tne_temporal_temporal` exports rather than introducing a separate `teq_tgeo_tgeo` MEOS function. Previously-declared `Teq_temporal_temporal` / `Tne_temporal_temporal` in the TgeompointFunctions namespace become thin forwarders to the new `Teq_tgeo_tgeo` / `Tne_tgeo_tgeo` so existing references stay valid.

Registration in `tgeompoint.cpp` uses parallel `REG_SPATIAL_EA` / `REG_SPATIAL_TCMP` macros for the 24 total registrations.

Operator forms not registered

MobilityDB also exposes `?=` / `?<>` / `#=` / `#<>` for these. DuckDB's parser does not accept multi-character operator tokens starting with `?` or `#`, so only named functions are registered. This is consistent with PR #73 (`temporal_teq/tne` on tnumber/tbool/ttext) and PR #74 (temporal position predicates).

Tests

  • `test/sql/parity/054_tspatial_compops.test` — 9 assertions covering each ever/always op in all three directions and `temporal_teq`/`temporal_tne` returning the expected `tbool` sequenceset.
  • Full suite: 761 assertions / 14 test cases passing under `TZ=UTC`.

Coverage delta

Per the audit in PR #66:

  • `geo/054_tpoint_compops`: 0/6 → 6/6 (100%) by name.

Test plan

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

…al_teq/tne

Closes 100% of geo/054_tpoint_compops by name. Implements the spatial
comparison handlers that were previously declared as TODO in the
TgeompointFunctions header.

New handlers (16 total, two macro-driven blocks in tgeompoint_functions.cpp):

ever/always (returning bool):
- {Ever,Always}_{eq,ne}_{geo_tgeo, tgeo_geo, tgeo_tgeo}    (12)

temporal_teq / temporal_tne (returning tbool):
- {Teq,Tne}_{geo_tgeo, tgeo_geo, tgeo_tgeo}               (6, including tgeo_tgeo
                                                           reusing teq_temporal_temporal /
                                                           tne_temporal_temporal MEOS exports)

The previously-declared Teq_temporal_temporal / Tne_temporal_temporal
in the TgeompointFunctions namespace become thin forwarders to the new
Teq_tgeo_tgeo / Tne_tgeo_tgeo (so existing references stay valid).

Registrations in tgeompoint.cpp (24 total via REG_SPATIAL_EA / REG_SPATIAL_TCMP
macros):

- ever_eq / always_eq / ever_ne / always_ne for (geometry × tgeompoint),
  (tgeompoint × geometry), (tgeompoint × tgeompoint).
- temporal_teq / temporal_tne for the same shape.

MobilityDB also exposes the operator forms `?=` / `?<>` / `#=` / `#<>` for
these; DuckDB's parser does not accept multi-character operator tokens
starting with `?` or `#`, so only the named functions are registered.

Test: test/sql/parity/054_tspatial_compops.test (9 assertions covering
each ever/always op in all three directions and temporal_teq/tne returning
the expected tbool sequenceset).
Full suite: 761 / 14 cases under TZ=UTC.

Files also gain a trailing newline at EOF.
@estebanzimanyi estebanzimanyi marked this pull request as ready for review May 1, 2026 19:13
@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