Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/962#discussion_r13368954
--- Diff: core/src/main/scala/org/apache/spark/rdd/HadoopRDD.scala ---
@@ -189,13 +190,18 @@ class HadoopRDD[K, V](
context.stageId, theSplit.index, context.attemptId.toInt, jobConf)
reader = inputFormat.getRecordReader(split.inputSplit.value,
jobConf, Reporter.NULL)
+ val inputMetrics = new InputMetrics(DataReadMethod.Hdfs)
+ context.taskMetrics.inputMetrics = Some(inputMetrics)
+
// Register an on-task-completion callback to close the input stream.
context.addOnCompleteCallback{ () => closeIfNeeded() }
val key: K = reader.createKey()
val value: V = reader.createValue()
override def getNext() = {
try {
+ val beginPosition = reader.getPos()
finished = !reader.next(key, value)
+ inputMetrics.bytesRead += reader.getPos() - beginPosition
--- End diff --
Can we just count the size when iterator.close is called (or the method in
context)?
---
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.
---