Skip to content

[GH-3200] Serialize empty Geography LineStrings as valid WKB - #3205

Closed
jiayuasu wants to merge 1 commit into
apache:masterfrom
jiayuasu:fix/geography-empty-wkb
Closed

[GH-3200] Serialize empty Geography LineStrings as valid WKB#3205
jiayuasu wants to merge 1 commit into
apache:masterfrom
jiayuasu:fix/geography-empty-wkb

Conversation

@jiayuasu

Copy link
Copy Markdown
Member

Did you read the Contributor Guide?

Is this PR related to a ticket?

What changes were proposed in this PR?

  • Write the required zero coordinate count when serializing an empty SinglePolylineGeography.
  • Produce valid LINESTRING EMPTY WKB instead of a header-only, malformed byte sequence.
  • Allow WKBGeography.fromS2Geography() to round-trip an empty LineString through JTS while preserving its SRID.

The malformed WKB was discovered while reviewing #3195. This PR isolates the pre-existing serialization defect from the ST_MakeLine feature. It does not define the separate behavior for ST_MakeLine(EMPTY, non-empty), which is tracked by #3202.

How was this patch tested?

  • Full common module suite: 1,181 tests, 0 failures.
  • Added an exact-WKB assertion for 010200000000000000.
  • Added WKB-to-S2 and S2-to-WKB-to-JTS empty LineString round-trip coverage.
  • Formatting and commit hooks passed.

Did this PR include necessary documentation updates?

  • No. This corrects malformed internal serialization without changing the public API.

@jiayuasu

Copy link
Copy Markdown
Member Author

Closing as superseded by #3195. The merged implementation now writes empty geography LineStrings as valid zero-coordinate WKB and also handles S2 singleton polylines by emitting an OGC-valid two-coordinate LineString, with round-trip coverage.

@jiayuasu jiayuasu closed this Jul 29, 2026
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.

[BUG]: Empty Geography LineStrings produce malformed WKB

1 participant