Kontinuation commented on code in PR #706:
URL: https://github.com/apache/incubator-sedona/pull/706#discussion_r1010365251
##########
sql/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/JoinQueryDetector.scala:
##########
@@ -164,9 +164,9 @@ class JoinQueryDetector(sparkSession: SparkSession) extends
Strategy {
val relationship = s"ST_$spatialPredicate"
matchExpressionsToPlans(a, b, left, right) match {
- case Some((planA, planB, _)) =>
+ case Some((planA, planB, swappedLeftAndRight)) =>
logInfo(s"Planning spatial join for $relationship relationship")
- RangeJoinExec(planLater(planA), planLater(planB), a, b,
spatialPredicate, extraCondition) :: Nil
+ RangeJoinExec(planLater(planA), planLater(planB), a, b,
swappedLeftAndRight, spatialPredicate, extraCondition) :: Nil
Review Comment:
Exec node has to handle the swapping somewhere, unless we invert the spatial
predicate in the join query detector.
Broadcast join exec node [resolves if left and right were
swapped](https://github.com/apache/incubator-sedona/blob/master/sql/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/BroadcastIndexJoinExec.scala#L117-L122)
using `indexBuildSide` and `windowJoinSide`, it does not seem to be more
intuitive than simply pushing the swapping indicator to the
`TraitJoinQueryExec` node.
Inverting the spatial predicate seems to be a viable approach, I'll submit
changes to this PR if you're OK with it.
--
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]