Read a geometry and a geography through the HexEWKB reader of each - #174
Merged
estebanzimanyi merged 1 commit intoOct 4, 2026
Merged
estebanzimanyi merged 1 commit into
estebanzimanyi merged 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.