Skip to content

cleanup(geo): retire stale Spherical_lonlat workaround; re-enable GEODSTBOX ZT area test#165

Open
estebanzimanyi wants to merge 2 commits into
MobilityDB:fix/bump-meos-pinfrom
estebanzimanyi:cleanup/retire-geodetic-stbox-workarounds
Open

cleanup(geo): retire stale Spherical_lonlat workaround; re-enable GEODSTBOX ZT area test#165
estebanzimanyi wants to merge 2 commits into
MobilityDB:fix/bump-meos-pinfrom
estebanzimanyi:cleanup/retire-geodetic-stbox-workarounds

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

@estebanzimanyi estebanzimanyi commented May 20, 2026

Summary

src/geo/stbox_functions.cpp carries three helpers — Spherical_lonlat_rect_area_m2, Geodetic_stbox_footprint_area, Stbox_geodetic_xy_copy — that workaround MEOS-1.3 bugs that the pinned MEOS-1.4 integration tip does not have:

Helper MEOS-1.4 status
Spherical_lonlat_rect_area_m2 / Geodetic_stbox_footprint_area stbox_area(GEODSTBOX ZT(((1,2,3),(4,5,6)),[2000-01-01,2000-01-02])) returns 110593375170.3 cleanly — no SIGSEGV on the PolyhedralSurface path
Stbox_geodetic_xy_copy stbox_to_geo projects 3D geodetic boxes to a 2D POLYGON with Z=0 internally
(geog_in WKT fall-through) fixed upstream in MobilityDB PR #1090 (closes #1089)

This PR

  • removes the three workaround helpers
  • replaces Stbox_area with a direct stbox_area call (the dead == DBL_MAX error sentinel becomes < 0, matching MEOS's documented -1.0 on error)
  • simplifies Stbox_expand_space to call stbox_to_geo directly
  • re-enables the GEODSTBOX ZT area test that was commented out, with MEOS's value (110593375170.3) as the expected output
  • adds GEODSTBOX X and GEODSTBOX Z area tests for coverage

Verification

Direct probes against the pinned MEOS-1.4 (integration/meos-1.4-bump):

GEODSTBOX ZT(((1.0,2.0,3.0),(4.0,5.0,6.0)),[2000-01-01,2000-01-02])
    stbox_area(spheroid=true)  = 110593375170.3
    stbox_area(spheroid=false) = 111083945187.3
GEODSTBOX X((1.0,2.0),(3.0,4.0))
    stbox_area(spheroid=true)  = 49173168695.2
GEODSTBOX Z((1.0,2.0,3.0),(4.0,5.0,6.0))
    stbox_area(spheroid=true)  = 110593375170.3

No SIGSEGV on any path.

Dependency

Requires the MEOS-1.4 vcpkg pin from #164 (or any pin that includes #1090). This PR stacks on #164.

Files changed

src/geo/stbox_functions.cpp | 51 ++++++-----------------------------------
test/sql/stbox.test         | 19 +++++++++++++-----
2 files changed, 18 insertions(+), 51 deletions(-)

Adds the SIZEOF_LONG_LONG emission to the rendered pg_config.h so the
DuckDB-Wasm (wasm32-emscripten / ILP32) build of MEOS no longer fails the
pg_bitutils integer-width check.
…tbox_area / stbox_to_geo

The Spherical_lonlat_rect_area_m2 / Geodetic_stbox_footprint_area /
Stbox_geodetic_xy_copy helpers were workarounds for two MEOS bugs that
no longer exist on the pinned MEOS-1.4 integration tip:

  - geog_in WKT fall-through SIGSEGV — FIXED upstream in MobilityDB
    PR #1090 (closes #1089).
  - stbox_area / stbox_to_geo SIGSEGV on 3D geodetic boxes — verified
    NOT-a-current-bug across multiple direct probes:
      stbox_area(GEODSTBOX ZT(((1,2,3),(4,5,6)),[2000-01-01,2000-01-02]))
      returns 110593375170.3 cleanly on the integration MEOS.

Replace the two-branch workaround in Stbox_area with a direct
stbox_area call, drop the manual Z-strip in Stbox_expand_space (MEOS
stbox_to_geo already projects 3D geodetic boxes to a 2D POLYGON with
Z=0 internally), and re-enable the previously commented test for the
GEODSTBOX ZT area case plus two new tests for X and Z geodetic shapes.

Also fix the existing error-sentinel check on Stbox_area: MEOS
stbox_area returns -1.0 on error (null box or no X dimension), not
DBL_MAX (an artifact of the spherical-approximation workaround path).

Stacks on PR MobilityDB#164 (vcpkg pin bump to MEOS-1.4-integration).
@estebanzimanyi estebanzimanyi changed the base branch from main to fix/bump-meos-pin May 30, 2026 08:00
@estebanzimanyi estebanzimanyi force-pushed the cleanup/retire-geodetic-stbox-workarounds branch from 204d8dd to 4240d50 Compare May 30, 2026 08:00
@estebanzimanyi estebanzimanyi force-pushed the fix/bump-meos-pin branch 4 times, most recently from fa2de57 to 17588c0 Compare June 2, 2026 09: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