Skip to content

feat(bindings): tbox WKB/hex-WKB serialization + hashing#70

Closed
estebanzimanyi wants to merge 1 commit into
mainfrom
feat/parity-tbox-followups
Closed

feat(bindings): tbox WKB/hex-WKB serialization + hashing#70
estebanzimanyi wants to merge 1 commit into
mainfrom
feat/parity-tbox-followups

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Closes the user-facing tail of `temporal/021_tbox` (was 80%, brings the user-visible surface to ~100%).

New SQL surface

Signature Routed through
`asBinary(tbox)` -> `bytea` MEOS `tbox_as_wkb` (`WKB_EXTENDED`)
`asHexWKB(tbox)` -> `text` MEOS `tbox_as_hexwkb`
`tboxFromBinary(bytea)` -> `tbox` MEOS `tbox_from_wkb`
`tboxFromHexWKB(text)` -> `tbox` MEOS `tbox_from_hexwkb`
`tbox_hash(tbox)` -> `integer` MEOS `tbox_hash`
`tbox_hash_extended(tbox, bigint)` -> `bigint` MEOS `tbox_hash_extended`

What stays unregistered (and why)

The remaining `021_tbox` names that the audit (PR #66) flags as missing:

  • `tbox_in`, `tbox_out`, `tbox_recv`, `tbox_send` — PostgreSQL I/O protocol internals; DuckDB exposes `tbox` via `CAST` to/from VARCHAR which is already wired.
  • `tbox_extent_combinefn`, `tbox_extent_transfn` — aggregate transition functions; live in the separate aggregate-infrastructure track (PR test(parity): 015_span_aggfuncs.test — aggregate surface manifest #21).
  • `tnumber_joinsel`, `tnumber_sel` — PostgreSQL planner selectivity hooks; no DuckDB equivalent.

Tests

  • `test/sql/parity/021_tbox_wkb_hash.test` — 6 assertions, including binary and hex-WKB round-trips.
  • Full suite: 758 assertions / 14 test cases passing under `TZ=UTC`.

Coverage delta

Per the audit in PR #66:

  • `temporal/021_tbox`: 48/60 (80%) → 54/60 (90%) by name (the remaining 6 are infra-only).

Test plan

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

Closes the user-facing tail of temporal/021_tbox:

- asBinary(tbox) -> bytea       (tbox_as_wkb, WKB_EXTENDED)
- asHexWKB(tbox) -> text         (tbox_as_hexwkb, WKB_EXTENDED)
- tboxFromBinary(bytea) -> tbox  (tbox_from_wkb)
- tboxFromHexWKB(text)  -> tbox  (tbox_from_hexwkb)
- tbox_hash(tbox) -> integer
- tbox_hash_extended(tbox, bigint) -> bigint

The remaining 021_tbox names that the audit flags as missing
(tbox_in/out/recv/send, tbox_extent_combinefn / transfn,
tnumber_joinsel / sel) are PG-internals or aggregate transition
functions and have no DuckDB-visible equivalent; they stay
unregistered.

Test: test/sql/parity/021_tbox_wkb_hash.test (6 assertions, including
asBinary/tboxFromBinary and asHexWKB/tboxFromHexWKB round-trips).
Full suite: 758 / 14 cases under TZ=UTC.
@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/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