Skip to content

feat(io): complete binary + hex-WKB round-trip I/O for all types#112

Open
estebanzimanyi wants to merge 1 commit intomainfrom
feat/wkb-roundtrip-all-types
Open

feat(io): complete binary + hex-WKB round-trip I/O for all types#112
estebanzimanyi wants to merge 1 commit intomainfrom
feat/wkb-roundtrip-all-types

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

@estebanzimanyi estebanzimanyi commented May 7, 2026

👀 Reviewers: tier ranking, dependency chains and the standards checklist live in doc/contributing/reviewer-guide.md.

Summary

  • asBinary / xFromBinary added for span (5 types), spanset (5 types), set (6 types), tgeometry, and tbool/tint/tfloat/ttext — all previously missing.
  • asHexWKB / xFromHexWKB added for the same surfaces; set had asHexWKB but was missing xFromHexWKB.
  • All types now have full binary + hex-WKB round-trip parity with tgeompoint / tgeogpoint / stbox / tbox.
  • wkb_roundtrip.test covers all 56 assertions (asBinary + asHexWKB round-trips for every type, including Parquet round-trip).
  • Also registers && (overlaps) between two tgeompoint values via overlaps_tspatial_tspatial.

Motivation

Uniform binary serialization is required for Parquet round-trips (COPY TO '*.parquet'). Without asBinary, types cannot be stored in BYTE_ARRAY Parquet columns and reloaded faithfully. asHexWKB is needed for text-based interchange (CSV, JSON, debug output).

Test plan

  • test/sql/wkb_roundtrip.test — 56 assertions, all pass locally
  • CI green on all platforms

@estebanzimanyi
Copy link
Copy Markdown
Member Author

Consolidation note — heavy overlap with main

After fixing the timezone-neutral test (a10ef79), this PR now reports mergeable: CONFLICTING because main has parallel commits adding the same surface:

File This PR main
src/temporal/{set,span,spanset}{,_functions}.cpp + .hpp adds *FromBinary/*FromHexWKB for span/spanset, Set_from_binary c8cad6d feat(parity): Binary/HexWKB I/O for sets, spans, spansets adds the same surface PLUS Set_from_hexwkb, span/spanset asBinary/asHexWKB
src/temporal/temporal.cpp adds tbool/tint/tfloat/ttext FromBinary afac6eb adds those plus *FromHexWKB and *FromMFJSON for the same types
src/geo/tgeometry_in_out.cpp adds tgeometryFromBinary 91102ae adds that plus tgeometry/tgeographyFromEWKB/HexWKB/HexEWKB/MFJSON/Text/EWKT

main's surface is a strict superset of this PR's surface. The unique value left in this PR is test/sql/wkb_roundtrip.test.

Suggested resolutions (maintainer's call — see docs/CONSOLIDATION-PLAN.md on #115)

  1. Close this PR, open a new test-only PR adding test/sql/wkb_roundtrip.test rebased on main. Cleanest history.
  2. Force-rebase this PR onto main and drop b6056b7 + bedba6a (their content is already in main); keep only a10ef79 (now the timezone-neutral test).
  3. Revert the parity commits on main (afac6eb, 91102ae, c8cad6d) and let this PR land instead. Loses the extras main has on top.

Pre-emptive policy this aimed to prevent: see docs/PR-COORDINATION.md on #115.

I'm not going to unilaterally rewrite this PR's history; pinging here so the maintainer can pick.

Adds asBinary / xFromBinary and asHexWKB / xFromHexWKB for the types
that were missing them, mirroring the roundtrip surface that
tgeompoint and tgeogpoint already had:

- Span (intspan / bigintspan / floatspan / datespan / tstzspan).
- Spanset (intspanset / bigintspanset / floatspanset / datespanset /
  tstzspanset).
- Set (intset / bigintset / floatset / textset / dateset / tstzset);
  asBinary already existed, fromBinary added.
- Tgeometry: asBinary / tgeometryFromBinary via temporal_as_wkb /
  temporal_from_wkb (subtype-agnostic MEOS exports).

The new wkb_roundtrip.test exercises every pair as a round-trip
equality check against the original input — assertions are
timezone-neutral (= comparisons or asText round-trips), so they hold
regardless of the process timezone (CI uses TZ=UTC, developer
machines may use anything).
@estebanzimanyi estebanzimanyi force-pushed the feat/wkb-roundtrip-all-types branch from a10ef79 to fe60666 Compare May 10, 2026 13:28
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