Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/17331#discussion_r106797210 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/SortMergeJoinExec.scala --- @@ -80,7 +80,18 @@ case class SortMergeJoinExec( override def requiredChildDistribution: Seq[Distribution] = ClusteredDistribution(leftKeys) :: ClusteredDistribution(rightKeys) :: Nil - override def outputOrdering: Seq[SortOrder] = requiredOrders(leftKeys) + override def outputOrdering: Seq[SortOrder] = joinType match { + case RightOuter => + // For right outer join, values of the left key will be filled with nulls if it can't + // match the value of the right key, so `nullOrdering` of the left key can't be guaranteed. + // We should output right key order here. + requiredOrders(rightKeys) --- End diff -- This is output ordering, right? The join result will be returned based on right keys?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org