Github user a-roberts commented on the issue:

    https://github.com/apache/spark/pull/15736
  
    I see, so doing the != comparison first which is likely to be true more of 
the time so we're not consistently failing this check then entering the else
    
    ```
      def getComparator[K](keyComparator: Option[Comparator[K]]): 
Comparator[(Int, K)] = {
        if (keyComparator.isDefined) {
          val theKeyComp = keyComparator.get
          new Comparator[(Int, K)] {
            // We know we have a non-empty comparator here
            override def compare(a: (Int, K), b: (Int, K)): Int = {
              if (a._1 != b._1) {
               a._1 - b._1
              } else {
               theKeyComp.compare(a._2, b._2)
              }
            }
          }
        } else {
          new Comparator[(Int, K)] {
            override def compare(a: (Int, K), b: (Int, K)): Int = {
              a._1 - b._1
            }
          }
        }
      }
    ```
    
    Again that builds fine


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

Reply via email to