Skip to content

Read a geometry and a geography through the HexEWKB reader of each - #174

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/geometry-hexewkb-codec
Oct 4, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/geometry-hexewkb-codec

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

The codec patterns of parser/enrich.py read a hex reader as from_hex?e?wkb and a hex writer as
as_hex?e?wkb, so they take the spelling MEOS gives the functions of the geometries,
geom_from_hexewkb, geog_from_hexewkb and geo_as_hexewkb, beside the _from_hexwkb and _as_hexwkb of
every other type. MobilityDB backs the SQL functions geometryFromHexEWKB(text),
geographyFromHexEWKB(text) and asHexEWKB(geometry|geography, text) with them, so the readers carry
SQL signatures returning geometry and geography, and the class they share, GSERIALIZED, states its
wkb encoding as Set or Temporal states theirs: readers keyed by SQL type, geom_from_hexewkb for
geometry and geog_from_hexewkb for geography, and the one writer geo_as_hexewkb as its wkb
encoder, its endian left NULL, which wkb_variant_from_endian reads as the machine's byte order.
Its text and MF-JSON forms carry no SQL signature, PostGIS owning geometry and geography, and keep
the functions the C shapes give them.

Witness: over MobilityDB master 2d13c5c42d, typeEncodings.GSERIALIZED states
readers.wkb = {geography: geog_from_hexewkb, geometry: geom_from_hexewkb} and
encoders.wkb = geo_as_hexewkb, where it stated no wkb encoding, so a binding reading a codec per
SQL type found none for geometry or geography.

Measured over MobilityDB master 2d13c5c42d, the catalog derived from the installed headers of a
libmeos built by tools/provision-meos.sh, against the catalog the same headers give on master:
GSERIALIZED is the one class whose codec changes; its 473 parameters gain the wkb encoding in
their wire; the three functions are filed under io rather than conversion; nothing else moves.
The suite passes its 497 tests, 25 skipped as on master, tests/test_codecs.py stating the codec on
a synthetic catalog and on the derived one.

Why: one GSERIALIZED stands for two SQL types, so a single decoder cannot tell a binding which of
them a string names; the reader each SQL type's own function provides can, as intset_in and
floatset_in do for Set.

The codec patterns of parser/enrich.py read a hex reader as _from_hex_?e?wkb and a hex writer as
_as_hex_?e?wkb, so they take the spelling MEOS gives the functions of the geometries,
geom_from_hexewkb, geog_from_hexewkb and geo_as_hexewkb, beside the _from_hexwkb and _as_hexwkb of
every other type. MobilityDB backs the SQL functions geometryFromHexEWKB(text),
geographyFromHexEWKB(text) and asHexEWKB(geometry|geography, text) with them, so the readers carry
SQL signatures returning geometry and geography, and the class they share, GSERIALIZED, states its
wkb encoding as Set or Temporal states theirs: readers keyed by SQL type, geom_from_hexewkb for
geometry and geog_from_hexewkb for geography, and the one writer geo_as_hexewkb as its wkb
encoder, its endian left NULL, which wkb_variant_from_endian reads as the machine's byte order.
Its text and MF-JSON forms carry no SQL signature, PostGIS owning geometry and geography, and keep
the functions the C shapes give them.

Witness: over MobilityDB master 2d13c5c42d, typeEncodings.GSERIALIZED states
readers.wkb = {geography: geog_from_hexewkb, geometry: geom_from_hexewkb} and
encoders.wkb = geo_as_hexewkb, where it stated no wkb encoding, so a binding reading a codec per
SQL type found none for geometry or geography.

Measured over MobilityDB master 2d13c5c42d, the catalog derived from the installed headers of a
libmeos built by tools/provision-meos.sh, against the catalog the same headers give on master:
GSERIALIZED is the one class whose codec changes; its 473 parameters gain the wkb encoding in
their wire; the three functions are filed under io rather than conversion; nothing else moves.
The suite passes its 497 tests, 25 skipped as on master, tests/test_codecs.py stating the codec on
a synthetic catalog and on the derived one.

Why: one GSERIALIZED stands for two SQL types, so a single decoder cannot tell a binding which of
them a string names; the reader each SQL type's own function provides can, as intset_in and
floatset_in do for Set.
@estebanzimanyi
estebanzimanyi merged commit 0d803e7 into MobilityDB:master Oct 4, 2026
3 checks passed
@estebanzimanyi
estebanzimanyi deleted the catalog/geometry-hexewkb-codec branch October 4, 2026 17:24
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