Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2ee4c02
Update FileBatchWrite.scala
AngersZhuuuu Feb 7, 2021
3fdda41
update
AngersZhuuuu Feb 7, 2021
cb5873c
Update FileBatchWrite.scala
AngersZhuuuu Feb 8, 2021
0f567f0
update
AngersZhuuuu Feb 8, 2021
d065bcd
Merge branch 'master' into SPARK-34399
AngersZhuuuu Feb 8, 2021
669be65
Merge branch 'master' into SPARK-34399
AngersZhuuuu Feb 9, 2021
89f8201
Merge branch 'master' into SPARK-34399
AngersZhuuuu Feb 9, 2021
9ddd28c
Merge branch 'master' into SPARK-34399
AngersZhuuuu Feb 20, 2021
e552a48
follow comment
AngersZhuuuu Feb 23, 2021
6bf5a88
Merge branch 'SPARK-34399' of https://github.com/AngersZhuuuu/spark i…
AngersZhuuuu Feb 23, 2021
4f40eae
Update BasicWriteStatsTracker.scala
AngersZhuuuu Feb 23, 2021
e334a4c
follow comment
AngersZhuuuu Feb 23, 2021
2cc84df
Add UT
AngersZhuuuu Feb 24, 2021
dc78903
Merge branch 'master' into SPARK-34399
AngersZhuuuu Mar 4, 2021
8638618
Merge branch 'master' into SPARK-34399
AngersZhuuuu Jul 14, 2021
f10f24a
update
AngersZhuuuu Jul 14, 2021
7c87991
Merge branch 'SPARK-34399' of https://github.com/AngersZhuuuu/spark i…
AngersZhuuuu Jul 15, 2021
160e56d
update
AngersZhuuuu Jul 15, 2021
e69e279
Update BasicWriteStatsTracker.scala
AngersZhuuuu Jul 15, 2021
b92f0e4
Update SQLMetricsSuite.scala
AngersZhuuuu Jul 15, 2021
1cbd31b
Update FileFormatWriter.scala
AngersZhuuuu Jul 15, 2021
559d766
update
AngersZhuuuu Jul 16, 2021
ee2e3cf
update
AngersZhuuuu Jul 17, 2021
5c41947
Update SQLMetricsSuite.scala
AngersZhuuuu Jul 17, 2021
b91b0ae
follow comment
AngersZhuuuu Jul 19, 2021
cc42403
Update BasicWriteStatsTracker.scala
AngersZhuuuu Jul 19, 2021
d3389c6
follow comment
AngersZhuuuu Jul 20, 2021
a4890f2
fix scalatype
AngersZhuuuu Jul 20, 2021
6d91e25
follow comment
AngersZhuuuu Jul 20, 2021
1192f6f
Update BasicWriteStatsTracker.scala
AngersZhuuuu Jul 20, 2021
7b2bb06
Update SQLMetricsSuite.scala
AngersZhuuuu Jul 20, 2021
8107d20
Update SQLMetricsSuite.scala
AngersZhuuuu Jul 21, 2021
9b5aa94
Update SQLMetricsSuite.scala
AngersZhuuuu Jul 21, 2021
b5c9d63
Update BasicWriteStatsTracker.scala
AngersZhuuuu Jul 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ class BasicWriteJobStatsTracker(
new BasicWriteTaskStatsTracker(serializableHadoopConf.value)
}

override def processCommitDuration(duration: Long): Unit = {
metrics(BasicWriteJobStatsTracker.DURATION_FILE_COMMIT).set(duration)
}

override def processStats(stats: Seq[WriteTaskStats]): Unit = {
Comment thread
AngersZhuuuu marked this conversation as resolved.
Outdated
val sparkContext = SparkContext.getActive.get
var partitionsSet: mutable.Set[InternalRow] = mutable.HashSet.empty
Expand Down Expand Up @@ -223,6 +227,7 @@ object BasicWriteJobStatsTracker {
private val NUM_OUTPUT_BYTES_KEY = "numOutputBytes"
private val NUM_OUTPUT_ROWS_KEY = "numOutputRows"
private val NUM_PARTS_KEY = "numParts"
private val DURATION_FILE_COMMIT = "durationCommit"
Comment thread
AngersZhuuuu marked this conversation as resolved.
Outdated
/** XAttr key of the data length header added in HADOOP-17414. */
val FILE_LENGTH_XATTR = "header.x-hadoop-s3a-magic-data-length"

Expand All @@ -232,7 +237,8 @@ object BasicWriteJobStatsTracker {
NUM_FILES_KEY -> SQLMetrics.createMetric(sparkContext, "number of written files"),
NUM_OUTPUT_BYTES_KEY -> SQLMetrics.createSizeMetric(sparkContext, "written output"),
NUM_OUTPUT_ROWS_KEY -> SQLMetrics.createMetric(sparkContext, "number of output rows"),
NUM_PARTS_KEY -> SQLMetrics.createMetric(sparkContext, "number of dynamic part")
NUM_PARTS_KEY -> SQLMetrics.createMetric(sparkContext, "number of dynamic part"),
DURATION_FILE_COMMIT-> SQLMetrics.createTimingMetric(sparkContext, "duration of commit files")
Comment thread
AngersZhuuuu marked this conversation as resolved.
Outdated
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ object FileFormatWriter extends Logging {
val (_, duration) = Utils.timeTakenMs { committer.commitJob(job, commitMsgs) }
logInfo(s"Write Job ${description.uuid} committed. Elapsed time: $duration ms.")

processStats(description.statsTrackers, ret.map(_.summary.stats))
processStats(description.statsTrackers, ret.map(_.summary.stats), duration)
Comment thread
cloud-fan marked this conversation as resolved.
logInfo(s"Finished processing stats for write job ${description.uuid}.")

// return a set of all the partition paths that were updated during this job
Expand Down Expand Up @@ -304,7 +304,8 @@ object FileFormatWriter extends Logging {
*/
private[datasources] def processStats(
statsTrackers: Seq[WriteJobStatsTracker],
statsPerTask: Seq[Seq[WriteTaskStats]])
statsPerTask: Seq[Seq[WriteTaskStats]],
duration: Long)
: Unit = {

val numStatsTrackers = statsTrackers.length
Expand All @@ -320,6 +321,7 @@ object FileFormatWriter extends Logging {
statsTrackers.map(_ => Seq.empty)
}

statsTrackers.foreach(_.processCommitDuration(duration))
statsTrackers.zip(statsPerTracker).foreach {
case (statsTracker, stats) => statsTracker.processStats(stats)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ trait WriteJobStatsTracker extends Serializable {
*/
def newTaskInstance(): WriteTaskStatsTracker

/**
* Process the duration of commit all files.
*/
def processCommitDuration(duration: Long): Unit

/**
* Process the given collection of stats computed during this job.
* E.g. aggregate them, write them to memory / disk, issue warnings, whatever.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FileBatchWrite(
val (_, duration) = Utils.timeTakenMs { committer.commitJob(job, results.map(_.commitMsg)) }
logInfo(s"Write Job ${description.uuid} committed. Elapsed time: $duration ms.")

processStats(description.statsTrackers, results.map(_.summary.stats))
processStats(description.statsTrackers, results.map(_.summary.stats), duration)
logInfo(s"Finished processing stats for write job ${description.uuid}.")
}

Expand Down