Repository navigation
[GH-3182] GeoPandas: Add point-only inner sjoin_nearest - #3184
Merged
Merged
Conversation
This was referenced Jul 27, 2026
jiayuasu
marked this pull request as draft
July 28, 2026 02:46
66 of 77 tasks
Implement distributed point nearest joins using existing ST_KNN behavior, with optional distance output and a maximum-distance result filter. Preserve geometry CRS metadata and document the supported API subset. Add GeoPandas comparisons and regular/broadcast KNN execution coverage.
jiayuasu
force-pushed
the
feature/geopandas-sjoin-nearest
branch
from
September 24, 2026 07:46
14bb592 to
43d8733
Compare
jiayuasu
marked this pull request as ready for review
September 24, 2026 08:03
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?
Partially addresses #3182 with an initial supported subset.
What changes were proposed in this PR?
Add
sjoin_nearestto the top-level GeoPandas API,tools, andGeoDataFramefor distributed point-only inner joins. The implementation uses existingST_KNN(left, right, 1, false)and the unchanged Sedona KNN engine.Supported behavior:
how="inner",exclusive=False, and defaultleft/rightsuffixes.distance_coland positive finitemax_distance.Unsupported options, non-point non-empty geometries, and ambiguous output columns fail explicitly. Distances are planar and ignore Z. Output row order is unspecified.
Tie behavior follows
spark.sedona.join.knn.includeTieBreakers, without changing the session setting. Its defaultfalseselects one nearest candidate with unspecified tie selection. Withtrue, equidistant candidates are included, but existing Sedona behavior can omit distinct rows with identical candidate geometries. This API does not promise GeoPandas' complete all-row tie behavior.max_distancefilters the nearest results; it does not prune the KNN search. A non-deterministic partition-ID guard keeps that filter above KNN execution, preventing Spark from pushing it into a join where existing planning can select a distance join or discard the condition in a broadcast KNN plan. The extra-condition planner bug is tracked in #3398. Input validation collects only scalar summaries; geometries remain distributed.How was this patch tested?
Did this PR include necessary documentation updates?
Yes. English and Chinese GeoPandas tutorials describe the supported subset and tie semantics. The 2.0.0 release notes include the new API.