You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "prantogg (via GitHub)" <gi...@apache.org> on 2026/05/16 00:38:35 UTC
[PR] fix: NullPointerException from deep traversal beyond GeoJSON geometry level [sedona]
prantogg opened a new pull request, #2959:
URL: https://github.com/apache/sedona/pull/2959
## Did you read the Contributor Guide?
- Yes, I have read the [Contributor Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest/community/develop/)
## Is this PR related to a ticket?
- No
## What changes were proposed in this PR?
The GeoJSON reader's `convertGeoJsonToGeometry` and `updateGeometrySchema` methods were recursing into all nested StructType fields unconditionally. When a GeoJSON feature had nested struct properties (e.g., `properties.prop1.nested_field`), the traversal would descend into those property-level structs looking for a "geometry" field to convert. If any such struct happened to have fields that didn't match expected geometry patterns, this caused a NullPointerException.
This PR fixes the issue by:
- Adding a `hasGeometryField` helper that detects whether the current struct level contains a "geometry" field
- Once a geometry-level struct is found, only the "geometry" field is converted; sibling struct/array fields are passed through as-is without further recursion
- Adding null-safety checks throughout the traversal to prevent NPE on null fields
- Updating `updateGeometrySchema` with the same bounded-recursion logic so schema updates stop at the first geometry level
## How was this patch tested?
- Updated the `geojson_feature-collection.json` test fixture to include nested struct properties (with multiple levels of nesting) that previously triggered the NPE
- Added a unit test `updateGeometrySchema should update first geometry struct only` that verifies schema traversal stops at the first geometry level and does not modify deeper "geometry" fields in property structs
- Existing GeoJSON read/write tests continue to pass
## Did this PR include necessary documentation updates?
- No, this PR does not affect any public API so no need to change the documentation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-752] fix: NullPointerException from deep traversal beyond GeoJSON geometry level [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu merged PR #2959:
URL: https://github.com/apache/sedona/pull/2959
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org