jiayuasu opened a new pull request, #3090: URL: https://github.com/apache/sedona/pull/3090
## 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 #3089 ## What changes were proposed in this PR? This PR fixes three related issues in the raster distance-join machinery built around `RS_DWithin`, reported in #3089. All changes are confined to `spark/common`. 1. **Native raster memory leak.** `RS_DWithin.eval` and the WGS84 envelope builders used by the join planner deserialize `GridCoverage2D` rasters but never dispose them, so a raster distance join leaks off-heap memory on every row — a real problem on long-running executors. The affected sites are: - `RS_DWithin.eval` (`RasterPredicates.scala`) - `TraitJoinQueryBase.toExpandedWGS84EnvelopeRDD` - both raster branches in `BroadcastIndexJoinExec` that build the expanded WGS84 envelope Each deserialized raster is now wrapped in `try/finally` and released with `raster.dispose(true)`, mirroring the discipline already used by `RS_Predicate.evaluator`. 2. **Empty-envelope false positive.** When a raster or geometry input is `NULL`, the join substitutes an empty `GeometryCollection`. `expandRasterFilterEnvelope` then expanded that geometry's degenerate envelope by `distance`, yielding a *non-empty* filter geometry that spuriously matched rows the per-row predicate would reject. It now returns the empty shape unchanged so the coarse R-tree filter excludes it. 3. **Misleading EXPLAIN output.** The raster distance branch of `BroadcastIndexJoinExec.simpleString` printed `RS_Distance(left, right) < r` — a function that does not exist in Sedona. It now prints `RS_DWithin(left, right, r)`, naming the actual predicate that drives the join. ## How was this patch tested? `sedona-spark-common` compiles cleanly with the changes. The fixes are minimal, mechanical resource-management changes within existing code paths exercised by the existing `RasterJoinSuite` and `BroadcastIndexJoinSuite`. ## 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
