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

    https://github.com/apache/spark/pull/3422#discussion_r29811379
  
    --- Diff: 
core/src/main/scala/org/apache/spark/util/collection/ExternalSorter.scala ---
    @@ -748,6 +759,12 @@ private[spark] class ExternalSorter[K, V, C](
     
         context.taskMetrics.memoryBytesSpilled += memoryBytesSpilled
         context.taskMetrics.diskBytesSpilled += diskBytesSpilled
    +    context.taskMetrics.shuffleWriteMetrics.filter(_ => 
bypassMergeSort).foreach { m =>
    --- End diff --
    
    I was reading through `ExternalSorter` to try to understand how shuffle 
write time metrics are calculated and came across this line.  This style is 
confusing to a casual reader: it looks like the logic here is "if shuffle write 
metrics are defined and merge sort is bypassed, then run this block", but this 
is slightly obfuscated by the fact that we're filtering an option with a filter 
function that doesn't depend on that option's value.
    
    For next time, I think we should just use a simple `if` statement instead.


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