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

    https://github.com/apache/spark/pull/2087#discussion_r19419188
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/HadoopRDD.scala ---
    @@ -224,18 +223,18 @@ class HadoopRDD[K, V](
           val key: K = reader.createKey()
           val value: V = reader.createValue()
     
    -      // Set the task input metrics.
           val inputMetrics = new InputMetrics(DataReadMethod.Hadoop)
    -      try {
    -        /* bytesRead may not exactly equal the bytes read by a task: split 
boundaries aren't
    -         * always at record boundaries, so tasks may need to read into 
other splits to complete
    -         * a record. */
    -        inputMetrics.bytesRead = split.inputSplit.value.getLength()
    -      } catch {
    -        case e: java.io.IOException =>
    -          logWarning("Unable to get input size to set InputMetrics for 
task", e)
    +      // Find a function that will return the FileSystem bytes read by 
this thread.
    +      val bytesReadCallback = if 
(split.inputSplit.value.isInstanceOf[FileSplit]) {
    +        SparkHadoopUtil.get.getFSBytesReadOnThreadCallback(
    +          split.inputSplit.value.asInstanceOf[FileSplit].getPath, jobConf)
    +      } else {
    +        None
    +      }
    +      if (bytesReadCallback.isDefined) {
    +        context.taskMetrics.inputMetrics = Some(inputMetrics)
           }
    -      context.taskMetrics.inputMetrics = Some(inputMetrics)
    --- End diff --
    
    Gotcha - maybe we can add a comment about this later.



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