Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19281#discussion_r139875187
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/joins/SortMergeJoinExec.scala
 ---
    @@ -101,14 +101,15 @@ case class SortMergeJoinExec(
             s"${getClass.getSimpleName} should not take $x as the JoinType")
       }
     
    -  /**
    -   * For SMJ, child's output must have been sorted on key or expressions 
with the same order as
    -   * key, so we can get ordering for key from child's output ordering.
    -   */
       private def getKeyOrdering(keys: Seq[Expression], childOutputOrdering: 
Seq[SortOrder])
         : Seq[SortOrder] = {
    -    keys.zip(childOutputOrdering).map { case (key, childOrder) =>
    -      SortOrder(key, Ascending, childOrder.sameOrderExpressions + 
childOrder.child - key)
    +    val requiredOrdering = requiredOrders(keys)
    +    if (SparkPlan.orderingSatisfies(childOutputOrdering, 
requiredOrdering)) {
    --- End diff --
    
    Please add a comment here to explain the reason.


---

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

Reply via email to