[GH-3333] Handle leading nulls in local GeoSeries construction - #3349
Open
jiayuasu wants to merge 1 commit into
Open
[GH-3333] Handle leading nulls in local GeoSeries construction#3349jiayuasu wants to merge 1 commit into
jiayuasu wants to merge 1 commit into
Conversation
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.
Did you read the Contributor Guide?
Yes, I have read the Contributor Rules and Contributor Development Guide.
Is this PR related to a ticket?
Closes #3333.
What changes were proposed in this PR?
On Spark 3.5, local input such as
GeoSeries([None, Point(1, 2)])fails withArrowInvalid: pandas-on-Spark checks the first value to infer the geometry type, so a leading null prevents it from recognizing later geometries.For local input that starts with a missing value and contains a geometry, normalize missing entries, encode the values as well-known binary (WKB) with embedded SRIDs, and construct the geometry column with
ST_GeomFromWKB. Restore the original Series name after WKB conversion. This preserves input order, index, name, geometry dimensions, and existing CRS handling. Other constructor paths remain unchanged.How was this patch tested?
The new tests produced 13
ArrowInvalidfailures on the unchanged Spark 3.5 constructor, with three controls passing. A separate regression check caught both pandas and NumPyNaTvalues before missing-value normalization was added.31 focused GeoSeries constructor, conversion, and CRS tests passed on each of Spark 3.5.0 and 4.1.1. Coverage includes local list, tuple, NumPy, pandas, GeoPandas, and GeometryArray inputs; missing-value variants; duplicate MultiIndex order; names; inherited and explicit CRS; empty geometries; and embedded SRID/Z preservation.
Current Python source was tested with cached JVM jars: released Sedona 1.9.1 for Spark 3.5 and a prior local 2.0.0-SNAPSHOT build for Spark 4.1. No fresh JVM rebuild was performed. Formatting and pre-commit checks passed.
Did this PR include necessary documentation updates?
No documentation changes are needed. This fixes an existing constructor path without changing the public API.