srowen commented on a change in pull request #24241: 
[SPARK-27323][CORE][SQL][STREAMING] Use Single-Abstract-Method support in Scala 
2.12 to simplify code
URL: https://github.com/apache/spark/pull/24241#discussion_r270979235
 
 

 ##########
 File path: 
core/src/main/scala/org/apache/spark/util/collection/ExternalSorter.scala
 ##########
 @@ -400,13 +395,12 @@ private[spark] class ExternalSorter[K, V, C](
       mergeCombiners: (C, C) => C,
       comparator: Comparator[K],
       totalOrder: Boolean)
-      : Iterator[Product2[K, C]] =
-  {
+      : Iterator[Product2[K, C]] = {
     if (!totalOrder) {
       // We only have a partial ordering, e.g. comparing the keys by hash 
code, which means that
       // multiple distinct keys might be treated as equal by the ordering. To 
deal with this, we
       // need to read all keys considered equal by the ordering at once and 
compare them.
-      new Iterator[Iterator[Product2[K, C]]] {
+      val it = new Iterator[Iterator[Product2[K, C]]] {
 
 Review comment:
   I was trying to convert the `flatMap(i => i)` below to simply `flatten`. For 
reasons even I'm not clear about, I had to introduce an intermediate val here 
then return `it.flatten` to get it to work. Seems harmless enough as a change 
but I didn't get the difference in type inference

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to