iGN5117 commented on code in PR #1208:
URL: https://github.com/apache/sedona/pull/1208#discussion_r1468733640


##########
spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/JoinQueryDetector.scala:
##########
@@ -140,6 +134,18 @@ class JoinQueryDetector(sparkSession: SparkSession) 
extends Strategy {
         case Some(And(extraCondition, predicate: RS_Predicate)) =>
           getRasterJoinDetection(left, right, predicate, Some(extraCondition))
         // For distance joins we execute the actual predicate (condition) and 
not only extraConditions.
+        case Some(ST_DWithin(Seq(leftShape, rightShape, distance))) =>
+          Some(JoinQueryDetection(left, right, leftShape, rightShape, 
SpatialPredicate.INTERSECTS, isGeography = false, condition, Some(distance)))
+        case Some(And(ST_DWithin(Seq(leftShape, rightShape, distance)), _)) =>
+          Some(JoinQueryDetection(left, right, leftShape, rightShape, 
SpatialPredicate.INTERSECTS, isGeography = false, condition, Some(distance)))
+        case Some(And(_, ST_DWithin(Seq(leftShape, rightShape, distance)))) =>
+          Some(JoinQueryDetection(left, right, leftShape, rightShape, 
SpatialPredicate.INTERSECTS, isGeography = false, condition, Some(distance)))
+        case Some(ST_DWithin(Seq(leftShape, rightShape, distance, 
useSpheroid))) =>
+          Some(JoinQueryDetection(left, right, leftShape, rightShape, 
SpatialPredicate.INTERSECTS, isGeography = 
useSpheroid.eval().asInstanceOf[Boolean], condition, Some(distance)))
+        case Some(And(ST_DWithin(Seq(leftShape, rightShape, distance, 
useSpheroid)), _)) =>
+          Some(JoinQueryDetection(left, right, leftShape, rightShape, 
SpatialPredicate.INTERSECTS, isGeography = 
useSpheroid.eval().asInstanceOf[Boolean], condition, Some(distance)))
+        case Some(And(_, ST_DWithin(Seq(leftShape, rightShape, distance, 
useSpheroid)))) =>
+          Some(JoinQueryDetection(left, right, leftShape, rightShape, 
SpatialPredicate.INTERSECTS, isGeography = 
useSpheroid.eval().asInstanceOf[Boolean], condition, Some(distance)))

Review Comment:
   @Kontinuation I've added a try-catch to revert back to cartesian join. I 
went with a blanket catch because I was getting 2 different types of exceptions 
based on running the entire suite vs a single test.
   Let me know if this is okay



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