Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/17331#discussion_r106798699
--- 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)
+ case FullOuter =>
+ // Neither left key nor right key guarantees `nullOrdering` after
full outer join.
+ Nil
+ case _ =>
--- End diff --
If possible, please use the white list. Otherwise, we might forget to
update this when adding new join types. Then, we should issue the exception for
the default case.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]