Github user mgaido91 commented on a diff in the pull request: https://github.com/apache/spark/pull/21156#discussion_r200940409 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/SortMergeJoinExec.scala --- @@ -76,8 +76,36 @@ case class SortMergeJoinExec( s"${getClass.getSimpleName} should not take $x as the JoinType") } - override def requiredChildDistribution: Seq[Distribution] = - HashClusteredDistribution(leftKeys) :: HashClusteredDistribution(rightKeys) :: Nil + private def avoidShuffleIfPossible( + joinKeys: Seq[Expression], + expressions: Seq[Expression]): Seq[Distribution] = { + val indices = expressions.map(x => joinKeys.indexWhere(_.semanticEquals(x))) --- End diff -- what if here we don't find an expression? I think it would return -1 causing an error when using the index later. Can we also add a test case for this situation?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org