Skip to content

feat(geo): add nearestApproachDistance, expandSpace, && for TGEOMPOINT#114

Open
estebanzimanyi wants to merge 1 commit intofeat/edge-to-cloud-quickstartfrom
feat/berlinmod-geo-functions2
Open

feat(geo): add nearestApproachDistance, expandSpace, && for TGEOMPOINT#114
estebanzimanyi wants to merge 1 commit intofeat/edge-to-cloud-quickstartfrom
feat/berlinmod-geo-functions2

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Summary

Adds three MEOS-backed functions that complete BerlinMOD portable SQL coverage on MobilityDuck:

  • nearestApproachDistance(TGEOMPOINT, TGEOMPOINT) → DOUBLE — wraps nad_tgeo_tgeo; returns NULL (not 0) when trips have no overlapping time extent (sentinel DBL_MAX → SQL NULL via ExecuteWithNulls)
  • expandSpace(TGEOMPOINT, DOUBLE) → STBOX — wraps tspatial_to_stbox + stbox_expand_space; enables the trip && expandSpace(other, dist) index pre-filter in Q10
  • &&(TGEOMPOINT, TGEOMPOINT) → BOOLEAN — wraps overlaps_tspatial_tspatial; STBox overlap pre-filter for cross-trip joins

BerlinMOD impact:

Query Function Before After
Q05 nearestApproachDistance
Q10 expandSpace

16/18 queries already worked on the released community extension; this adds the missing 2.

Stacked on: #113 (edge-to-cloud quickstart + SRID/geodetic fix). Merge #113 first; GitHub will rebase this PR onto main automatically.

Cross-references:

Test plan

  • CI green (Linux amd64 + arm64)
  • nearestApproachDistance(trip1, trip2) returns correct float, NULL when disjoint in time
  • expandSpace(trip, 3.0) returns STBox expanded by 3 units spatially
  • BerlinMOD Q05 and Q10 pass with toy dataset via ./berlinmod/run_mduck.sh from MobilitySpark

Register three MEOS-backed function overloads needed for portable
BerlinMOD queries:
- overlaps_tspatial_tspatial → &&(TGEOMPOINT, TGEOMPOINT)
- nad_tgeo_tgeo → nearestApproachDistance(TGEOMPOINT, TGEOMPOINT)
- tspatial_to_stbox + stbox_expand_space → expandSpace(TGEOMPOINT, DOUBLE)
@estebanzimanyi estebanzimanyi force-pushed the feat/edge-to-cloud-quickstart branch from d88b909 to e3c62fd Compare May 8, 2026 04:47
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