zhangfengcdt commented on code in PR #2871:
URL: https://github.com/apache/sedona/pull/2871#discussion_r3179168409
##########
spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/JoinQueryDetector.scala:
##########
@@ -843,9 +886,33 @@ class JoinQueryDetector(sparkSession: SparkSession)
extends SparkStrategy {
.map { distanceExpr =>
matchDistanceExpressionToJoinSide(distanceExpr, left, right) match {
case Some(side) =>
- if (broadcastSide.get == side) (Some(distanceExpr), None)
- else if (distanceExpr.references.isEmpty) (Some(distanceExpr),
None)
- else (None, Some(distanceExpr))
+ if (geographyShape) {
+ // Geography distance joins read the per-row radius from the
stream-side
+ // GeographyJoinShape inside GeographyDistanceRefiner, so the
radius MUST
+ // be available on the streamed side. The stream-side expression
is later
+ // re-bound against `streamed.output` in BroadcastIndexJoinExec,
so we
+ // can only forward it to the stream side when it is either a
literal
+ // (no references) or already bound to the streamed side.
+ if (distanceExpr.references.isEmpty) {
+ // Literal: keep build-side expansion AND populate stream-side
radius.
+ (Some(distanceExpr), Some(distanceExpr))
Review Comment:
Good catch! Yes, it double expand. The geography path was expanding both
sides while the geometry path expands only one. I have fixed this so the
geography follow the geometry approach.
--
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]