cloud-fan commented on a change in pull request #29084:
URL: https://github.com/apache/spark/pull/29084#discussion_r453480891



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkStrategies.scala
##########
@@ -191,15 +191,19 @@ abstract class SparkStrategies extends 
QueryPlanner[SparkPlan] {
         def createSortMergeJoin() = {
           if (RowOrdering.isOrderable(leftKeys)) {
             Some(Seq(joins.SortMergeJoinExec(
-              leftKeys, rightKeys, joinType, condition, planLater(left), 
planLater(right))))
+              leftKeys, rightKeys, joinType, nonEquiCond, planLater(left), 
planLater(right))))
           } else {
             None
           }
         }
 
         def createCartesianProduct() = {
           if (joinType.isInstanceOf[InnerLike]) {
-            Some(Seq(joins.CartesianProductExec(planLater(left), 
planLater(right), p.condition)))
+            // Since for join hint [[SHUFFLE_REPLICATE_NL]] when having equi 
join conditions,
+            // we still choose Cartesian Product Join, but in 
ExtractEquiJoinKeys, it will filter
+            // out equi condition. Instead of using the condition extracted by 
ExtractEquiJoinKeys,
+            // we should use the original join condition "j.condition".

Review comment:
       how about:
   ```
   `CartesianProductExec` can't implicitly evaluate the equal join condition, 
here we should
   pass the original condition which includes both equal and non-equal 
conditions.
   ```




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to