Copilot commented on code in PR #3090:
URL: https://github.com/apache/sedona/pull/3090#discussion_r3503862045


##########
spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/TraitJoinQueryBase.scala:
##########
@@ -188,6 +188,12 @@ trait TraitJoinQueryBase {
   private[join] def expandRasterFilterEnvelope(
       baseShape: Geometry,
       distance: Double): Geometry = {
+    // An empty shape (e.g. the empty GeometryCollection substituted for a 
NULL raster/geometry)
+    // must stay empty: expanding its degenerate envelope by `distance` would 
yield a non-empty
+    // filter geometry that spuriously matches rows the predicate should never 
join.
+    if (baseShape.isEmpty) {
+      return baseShape
+    }

Review Comment:
   This change fixes NULL/empty-shape handling in `expandRasterFilterEnvelope`, 
but there doesn’t appear to be a regression test covering the motivating case 
(RS_DWithin distance join where one side’s raster/geometry is NULL). 
RasterJoinSuite’s RS_DWithin tests exercise polar/antimeridian inputs but not 
NULLs, so a future refactor could reintroduce the empty-envelope expansion 
without failing CI. Consider adding a focused test that includes a NULL 
raster/geometry row and asserts the join executes and returns no matches 
involving the NULL input (and, if possible, that the optimized join plan is 
used).



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

Reply via email to