You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "jiayuasu (via GitHub)" <gi...@apache.org> on 2026/10/13 05:09:14 UTC

[PR] [GH-3449] Give an empty query geometry no neighbors in planar KNN joins [sedona]

jiayuasu opened a new pull request, #3450:
URL: https://github.com/apache/sedona/pull/3450

   ## 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?
   
   - Yes, and the PR name follows the format `[GH-XXX] my subject`. Closes #3449
   
   ## What changes were proposed in this PR?
   
   In a broadcast KNN join with the planar metric, an empty query geometry got k arbitrary neighbors: `EuclideanItemDistance` uses JTS `Geometry.distance`, which returns 0 for an empty geometry. The partitioned KNN join returns no neighbors for it, so the result depended on the join strategy.
   
   - `EuclideanItemDistance` ranks a pair with an empty geometry as infinitely far apart, as #3441 did for the sphere and spheroid metrics. The nearest-neighbor search never accepts a pair at infinite distance, so an empty query geometry gets no neighbors. Empty object geometries were already never returned, since the STRtree skips their null envelopes.
   - Extend the #3441 tests to the planar metric: the RDD broadcast KNN join (both broadcast sides) and the SQL KNN join (regular, broadcast query and broadcast object plans).
   - Update the KNN docs: empty geometries are skipped for every metric, not only when `use_spheroid` is true.
   
   ## How was this patch tested?
   
   - Without the fix, the 4 new planar broadcast cases fail: the empty query geometries get two arbitrary neighbors each. With it they pass.
   - `KnnJoinQueryTest`, `KnnJoinSuite`, `scalaTest` and `BarrierFunctionTest`: 131 passed.
   - `PointKnnTest`, `LineStringKnnTest`, `RectangleKnnTest`, `PolygonKnnTest` and `JoinQueryTest`: 102 passed.
   
   ## Did this PR include necessary documentation updates?
   
   - Yes, I have updated 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] [GH-3449] Give an empty query geometry no neighbors in planar KNN joins [sedona]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu merged PR #3450:
URL: https://github.com/apache/sedona/pull/3450


-- 
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