Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/10815#discussion_r50059413
--- Diff: core/src/main/scala/org/apache/spark/util/JsonProtocol.scala ---
@@ -720,58 +710,54 @@ private[spark] object JsonProtocol {
metrics.setResultSerializationTime((json \ "Result Serialization
Time").extract[Long])
metrics.incMemoryBytesSpilled((json \ "Memory Bytes
Spilled").extract[Long])
metrics.incDiskBytesSpilled((json \ "Disk Bytes
Spilled").extract[Long])
- metrics.setShuffleReadMetrics(
- Utils.jsonOption(json \ "Shuffle Read
Metrics").map(shuffleReadMetricsFromJson))
- metrics.shuffleWriteMetrics =
- Utils.jsonOption(json \ "Shuffle Write
Metrics").map(shuffleWriteMetricsFromJson)
- metrics.setInputMetrics(
- Utils.jsonOption(json \ "Input Metrics").map(inputMetricsFromJson))
- metrics.outputMetrics =
- Utils.jsonOption(json \ "Output Metrics").map(outputMetricsFromJson)
- metrics.updatedBlocks =
- Utils.jsonOption(json \ "Updated Blocks").map { value =>
- value.extract[List[JValue]].map { block =>
- val id = BlockId((block \ "Block ID").extract[String])
- val status = blockStatusFromJson(block \ "Status")
- (id, status)
- }
- }
- metrics
- }
- def shuffleReadMetricsFromJson(json: JValue): ShuffleReadMetrics = {
- val metrics = new ShuffleReadMetrics
- metrics.incRemoteBlocksFetched((json \ "Remote Blocks
Fetched").extract[Int])
- metrics.incLocalBlocksFetched((json \ "Local Blocks
Fetched").extract[Int])
- metrics.incFetchWaitTime((json \ "Fetch Wait Time").extract[Long])
- metrics.incRemoteBytesRead((json \ "Remote Bytes Read").extract[Long])
- metrics.incLocalBytesRead((json \ "Local Bytes
Read").extractOpt[Long].getOrElse(0))
- metrics.incRecordsRead((json \ "Total Records
Read").extractOpt[Long].getOrElse(0))
- metrics
- }
+ // Shuffle read metrics
+ Utils.jsonOption(json \ "Shuffle Read Metrics").foreach { readJson =>
+ val readMetrics = metrics.registerTempShuffleReadMetrics()
+ readMetrics.incRemoteBlocksFetched((readJson \ "Remote Blocks
Fetched").extract[Int])
+ readMetrics.incLocalBlocksFetched((readJson \ "Local Blocks
Fetched").extract[Int])
+ readMetrics.incRemoteBytesRead((readJson \ "Remote Bytes
Read").extract[Long])
+ readMetrics.incLocalBytesRead((readJson \ "Local Bytes
Read").extractOpt[Long].getOrElse(0L))
+ readMetrics.incFetchWaitTime((readJson \ "Fetch Wait
Time").extract[Long])
+ readMetrics.incRecordsRead((readJson \ "Total Records
Read").extractOpt[Long].getOrElse(0L))
+ metrics.mergeShuffleReadMetrics()
+ }
- def shuffleWriteMetricsFromJson(json: JValue): ShuffleWriteMetrics = {
- val metrics = new ShuffleWriteMetrics
- metrics.incShuffleBytesWritten((json \ "Shuffle Bytes
Written").extract[Long])
- metrics.incShuffleWriteTime((json \ "Shuffle Write
Time").extract[Long])
- metrics.setShuffleRecordsWritten((json \ "Shuffle Records Written")
- .extractOpt[Long].getOrElse(0))
- metrics
- }
+ // Shuffle write metrics
+ // TODO: Drop the redundant "Shuffle" since it's inconsistent with
related classes.
--- End diff --
yes, but if we're gonna break it anyway then we should change that.
Otherwise we don't have to.
---
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]