Skip to content

TINKERPOP-2558: Geometry serialization and GLV geometry types - #3812

Open
GumpacG wants to merge 3 commits into
apache:masterfrom
GumpacG:geospatial-serialization
Open

GumpacG wants to merge 3 commits into
apache:masterfrom
GumpacG:geospatial-serialization

Conversation

@GumpacG

@GumpacG GumpacG commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Follow up implementation pull request for the geospatial proposal (proposal-geospatial-10.asciidoc). It builds on #3754, which added the Geometry value type, and #3809, which added the geo predicates and the delivery toy graph. It lets geometries cross the wire: serialization in GraphBinary, GraphSON and Gryo, and geometry types with a GraphBinary codec in each GLV.

Changes

  • GraphBinary: type code 0x31, value {srid}{wkb}, an Int SRID followed by ISO WKB with no length prefix.
    GeometrySerializer reads through Geometry.fromWkb(InputStream, int), a new public method that reads one geometry from a stream.
  • GraphSON 4: {"wkt": ..., "srid": ...}, registered in the core module. Every SRID round-trips, including OTHER ones. Reading requires a string wkt without an EWKT prefix and an integer srid.
  • Gryo 1 and 3: one registration per kind, ids 205 to 211, with the body {srid}{length}{wkb}.
  • GLVs: Python, JavaScript, .NET and Go each gain the seven kinds, the abstract Curve, Surface, MultiCurveandMultiSurface, Model`, and a GraphBinary codec. Values validate on construction, compare exactly, and write WKT, EWKT and big-endian ISO WKB.
  • Fixtures: 10 .gbin and 10 .json geometry files in gremlin-test, with their Model entries.
  • Delivery graph data files: data/tinkerpop-delivery.kryo (Gryo 3), data/tinkerpop-delivery.json (GraphSON 4) and a tinkerpop-delivery-v3.kryo test resource, following the zoo graph. LoadGraphWith.DELIVERY.location() and TestFiles return the Gryo file instead of throwing.
  • Gherkin: the @DataGeometry scenarios now run in the remote Java feature tests. The server test configurations gain a delivery graph with a gdelivery traversal source, and RemoteWorld maps it. Hadoop, Spark and the GLV runners still exclude them.
  • Docs: the formats in the GraphBinary and GraphSON IO docs, and a geometry section for each GLV in the reference docs. The delivery data page and the data index list the new files, and the upgrade notes, for-committers and gremlin-variants no longer say geometries cannot be serialized.

Testing

  • New unit tests: GeometrySerializerTest, GeometryGraphSONTest, and new tests in WkbTest, GryoMapperTest, the IO compatibility tests, AbstractRoundTripTestandTinkerGraphIoStepTest. In each GLV, geometry and codec tests plus the shared fixtures. DefaultGraphManagerTestandCheckedGraphManagerTest` count the new graph.
  • The @DataGeometry scenarios pass in the 6 remote feature tests: all 56 in the 5 OLTP classes, and 41 in the computer class, which excludes the rest through the standard graph computer tag filter.
  • In every language: reading the WKB PostGIS writes for ST_AsBinary, writing exactly its XDR form, and rejecting ST_AsEWKB. Malformed and hostile WKB is tested against every reader check, and a mutation pass confirmed that breaking a check fails a test.

Assisted-by: Kiro:claude-opus-5.5

@codecov-commenter

codecov-commenter commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.94118% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.91%. Comparing base (a28cd1f) to head (826d3c1).
⚠️ Report is 1105 commits behind head on master.

Files with missing lines Patch % Lines
.../structure/io/binary/types/GeometrySerializer.java 43.33% 14 Missing and 3 partials ⚠️
...n/structure/io/graphson/GeometrySerializersV4.java 90.00% 0 Missing and 3 partials ⚠️
...pop/gremlin/structure/io/gryo/UtilSerializers.java 88.46% 2 Missing and 1 partial ⚠️
...g/apache/tinkerpop/gremlin/features/TestFiles.java 0.00% 3 Missing ⚠️
...che/tinkerpop/gremlin/structure/geo/WkbReader.java 96.49% 2 Missing ⚠️
...va/org/apache/tinkerpop/gremlin/LoadGraphWith.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3812      +/-   ##
============================================
+ Coverage     76.35%   78.91%   +2.55%     
- Complexity    13424    16082    +2658     
============================================
  Files          1012     1092      +80     
  Lines         60341    70418   +10077     
  Branches       7075     8380    +1305     
============================================
+ Hits          46076    55572    +9496     
+ Misses        11548    11488      -60     
- Partials       2717     3358     +641     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…y types to the GLVs

Adds GraphBinary, GraphSON and Gryo serialization for the Geometry type introduced in apache#3754. Adds matching geometry types with GraphBinary codecs to the Python, JavaScript, .NET and Go GLVs, tested against shared fixtures and PostGIS output.

Assisted-by: Kiro:claude-opus-5.5
…geo Gherkin scenarios in the remote Java tests, and update the docs that said geometries cannot be serialized

Assisted-by: Claude Code:claude-opus-5.5
Assisted-by: Claude Code:claude-opus-5.5
@GumpacG
GumpacG force-pushed the geospatial-serialization branch from cca2f6c to 826d3c1 Compare November 20, 2026 18:14
@GumpacG
GumpacG marked this pull request as ready for review November 20, 2026 18:30
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.

2 participants