Github user mridulm commented on a diff in the pull request:
https://github.com/apache/spark/pull/17276#discussion_r108052804
--- Diff:
core/src/main/scala/org/apache/spark/shuffle/sort/SortShuffleWriter.scala ---
@@ -72,6 +72,27 @@ private[spark] class SortShuffleWriter[K, V, C](
val partitionLengths = sorter.writePartitionedFile(blockId, tmp)
shuffleBlockResolver.writeIndexFileAndCommit(dep.shuffleId, mapId,
partitionLengths, tmp)
mapStatus = MapStatus(blockManager.shuffleServerId, partitionLengths)
+
+ mapStatus match {
+ case hc: HighlyCompressedMapStatus =>
+ val underestimatedLengths = partitionLengths.filter(_ >
hc.getAvgSize)
+
writeMetrics.incUnderestimatedBlocksSize(underestimatedLengths.sum)
+ if (log.isDebugEnabled() && partitionLengths.length > 0) {
+ // Distribution of sizes in MapStatus.
+ Distribution(partitionLengths.map(_.toDouble)) match {
+ case Some(distribution) =>
+ val distributionStr =
distribution.getQuantiles().mkString(", ")
+ logDebug(s"For task
${context.partitionId()}.${context.attemptNumber()} in stage" +
+ s" ${context.stageId()} (TID
${context.taskAttemptId()}), the block sizes in" +
+ s" MapStatus are inaccurate (average is
${hc.getAvgSize}," +
+ s" ${underestimatedLengths.length} blocks
underestimated, sum of sizes is" +
+ s" ${underestimatedLengths.sum}), distribution at the
given probabilities" +
+ s" (0, 0.25, 0.5, 0.75, 1.0) is $distributionStr.")
+ case None => // no-op
+ }
+ }
--- End diff --
Isn;t this not similar to what is in
core/src/main/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriter.java, etc
above ? Or is it different ?
The code looked same, but written differently (and more expensive here).
---
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]