Skip to content

feat(bindings): tgeompoint round-trip I/O — Binary/EWKB/HexWKB/HexEWKB/MFJSON#83

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

feat(bindings): tgeompoint round-trip I/O — Binary/EWKB/HexWKB/HexEWKB/MFJSON#83
estebanzimanyi wants to merge 1 commit into
mainfrom
feat/parity-tspatial-roundtrip-io

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Closes the user-facing round-trip I/O surface for tgeompoint so users can serialise temporal points across formats and reconstruct them.

New SQL surface (16 scalar registrations)

Producers

Signature Routed through
`asBinary(tgeompoint)` -> bytea `temporal_as_wkb`, base WKB
`asEWKB(tgeompoint)` -> bytea `temporal_as_wkb`, `WKB_EXTENDED` with SRID
`asHexWKB(tgeompoint)` -> text `temporal_as_hexwkb`, base
`asHexEWKB(tgeompoint)` -> text `temporal_as_hexwkb`, `WKB_EXTENDED`
`asMFJSON(tgeompoint[, with_bbox[, flags[, precision[, srs]]]])` -> text `temporal_as_mfjson` — 5 overloads

Consumers

Signature Routed through
`tgeompointFromText(text)` -> tgeompoint `tgeompoint_in`
`tgeompointFromEWKT(text)` -> tgeompoint `tgeompoint_in` — auto-detects EWKT prefix
`tgeompointFromBinary(bytea)` -> tgeompoint `temporal_from_wkb`
`tgeompointFromEWKB(bytea)` -> tgeompoint `temporal_from_wkb` — auto-detects
`tgeompointFromHexWKB(text)` -> tgeompoint `temporal_from_hexwkb`
`tgeompointFromHexEWKB(text)` -> tgeompoint `temporal_from_hexwkb` — auto-detects
`tgeompointFromMFJSON(text)` -> tgeompoint `tgeompoint_from_mfjson`

The `From*` aliases that share an underlying handler (e.g. FromBinary / FromEWKB) work because MEOS's WKB / hex-WKB readers auto-detect the format byte; the dual registrations are for SQL-name parity with MobilityDB.

Hooked into `LoadInternal` via a new `RegisterRoundtripIO` method on `TgeompointType`.

Tests

  • `test/sql/parity/053_tgeompoint_io.test` — 14 assertions covering producer non-empty output, all 7 round-trip pairs (Binary/EWKB/HexWKB/HexEWKB/MFJSON/Text/EWKT), and asMFJSON with optional `with_bbox` / `flags` / `precision` / `srs` args.
  • Full suite: 766 assertions / 14 test cases passing under `TZ=UTC`.

Coverage delta

Per the audit in PR #66:

  • `geo/053_tpoint_inout` was at 17%; closes the user-facing producer + tgeompointFrom* surface. Remaining names in this section are tgeogpoint (deferred — geographic variant out of scope per current sweep) and a few PG-internal helpers.

Test plan

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

…B/MFJSON

Closes the user-facing round-trip I/O surface for tgeompoint so that
users can serialise temporal points across formats and reconstruct
them.

New SQL surface (16 registrations):

Producers:
- asBinary(tgeompoint)   -> bytea   (temporal_as_wkb, base WKB)
- asEWKB(tgeompoint)     -> bytea   (temporal_as_wkb, WKB_EXTENDED with SRID)
- asHexWKB(tgeompoint)   -> text    (temporal_as_hexwkb, base)
- asHexEWKB(tgeompoint)  -> text    (temporal_as_hexwkb, WKB_EXTENDED)
- asMFJSON(tgeompoint[, with_bbox[, flags[, precision[, srs]]]])
                         -> text    (temporal_as_mfjson, 5 overloads)

Consumers:
- tgeompointFromText(text)      (tgeompoint_in)
- tgeompointFromEWKT(text)      (tgeompoint_in — auto-detects EWKT prefix)
- tgeompointFromBinary(bytea)   (temporal_from_wkb)
- tgeompointFromEWKB(bytea)     (temporal_from_wkb — auto-detects)
- tgeompointFromHexWKB(text)    (temporal_from_hexwkb)
- tgeompointFromHexEWKB(text)   (temporal_from_hexwkb — auto-detects)
- tgeompointFromMFJSON(text)    (tgeompoint_from_mfjson)

Hooked into LoadInternal via a new RegisterRoundtripIO method on
TgeompointType.

Test: test/sql/parity/053_tgeompoint_io.test (14 assertions covering
producer non-empty output, all 7 round-trip pairs, asMFJSON with
optional bbox/flags/precision/srs args).
Full suite: 766 / 14 cases under TZ=UTC.
@estebanzimanyi

Copy link
Copy Markdown
Member Author

Superseded by the consolidated PR branch consolidate/io-serialization-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