-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-34399][SQL] Add commit duration to SQL tab's graph node. #31522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
2ee4c02
Update FileBatchWrite.scala
AngersZhuuuu 3fdda41
update
AngersZhuuuu cb5873c
Update FileBatchWrite.scala
AngersZhuuuu 0f567f0
update
AngersZhuuuu d065bcd
Merge branch 'master' into SPARK-34399
AngersZhuuuu 669be65
Merge branch 'master' into SPARK-34399
AngersZhuuuu 89f8201
Merge branch 'master' into SPARK-34399
AngersZhuuuu 9ddd28c
Merge branch 'master' into SPARK-34399
AngersZhuuuu e552a48
follow comment
AngersZhuuuu 6bf5a88
Merge branch 'SPARK-34399' of https://github.com/AngersZhuuuu/spark i…
AngersZhuuuu 4f40eae
Update BasicWriteStatsTracker.scala
AngersZhuuuu e334a4c
follow comment
AngersZhuuuu 2cc84df
Add UT
AngersZhuuuu dc78903
Merge branch 'master' into SPARK-34399
AngersZhuuuu 8638618
Merge branch 'master' into SPARK-34399
AngersZhuuuu f10f24a
update
AngersZhuuuu 7c87991
Merge branch 'SPARK-34399' of https://github.com/AngersZhuuuu/spark i…
AngersZhuuuu 160e56d
update
AngersZhuuuu e69e279
Update BasicWriteStatsTracker.scala
AngersZhuuuu b92f0e4
Update SQLMetricsSuite.scala
AngersZhuuuu 1cbd31b
Update FileFormatWriter.scala
AngersZhuuuu 559d766
update
AngersZhuuuu ee2e3cf
update
AngersZhuuuu 5c41947
Update SQLMetricsSuite.scala
AngersZhuuuu b91b0ae
follow comment
AngersZhuuuu cc42403
Update BasicWriteStatsTracker.scala
AngersZhuuuu d3389c6
follow comment
AngersZhuuuu a4890f2
fix scalatype
AngersZhuuuu 6d91e25
follow comment
AngersZhuuuu 1192f6f
Update BasicWriteStatsTracker.scala
AngersZhuuuu 7b2bb06
Update SQLMetricsSuite.scala
AngersZhuuuu 8107d20
Update SQLMetricsSuite.scala
AngersZhuuuu 9b5aa94
Update SQLMetricsSuite.scala
AngersZhuuuu b5c9d63
Update BasicWriteStatsTracker.scala
AngersZhuuuu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,13 +22,17 @@ import java.io.File | |
| import scala.reflect.{classTag, ClassTag} | ||
| import scala.util.Random | ||
|
|
||
| import org.apache.hadoop.mapreduce.TaskAttemptContext | ||
|
|
||
| import org.apache.spark.internal.io.FileCommitProtocol | ||
| import org.apache.spark.sql._ | ||
| import org.apache.spark.sql.catalyst.expressions.aggregate.{Final, Partial} | ||
| import org.apache.spark.sql.catalyst.plans.logical.LocalRelation | ||
| import org.apache.spark.sql.execution._ | ||
| import org.apache.spark.sql.execution.adaptive.DisableAdaptiveExecutionSuite | ||
| import org.apache.spark.sql.execution.aggregate.HashAggregateExec | ||
| import org.apache.spark.sql.execution.command.DataWritingCommandExec | ||
| import org.apache.spark.sql.execution.datasources.{BasicWriteJobStatsTracker, SQLHadoopMapReduceCommitProtocol} | ||
| import org.apache.spark.sql.execution.exchange.{BroadcastExchangeExec, ShuffleExchangeExec} | ||
| import org.apache.spark.sql.execution.joins.ShuffledHashJoinExec | ||
| import org.apache.spark.sql.functions._ | ||
|
|
@@ -788,6 +792,24 @@ class SQLMetricsSuite extends SharedSparkSession with SQLMetricsTestUtils | |
| } | ||
| } | ||
|
|
||
| test("SPARK-34399: Add job commit duration metrics for DataWritingCommand") { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just happened to see the flakiness of the PR here: https://github.com/apache/spark/runs/4378978842 Seems not super flaky though. I am noting it here in case other people see this failure more. |
||
| withSQLConf(SQLConf.FILE_COMMIT_PROTOCOL_CLASS.key -> | ||
| "org.apache.spark.sql.execution.metric.CustomFileCommitProtocol") { | ||
| withTable("t", "t2") { | ||
| sql("CREATE TABLE t(id STRING) USING PARQUET") | ||
| val df = sql("INSERT INTO TABLE t SELECT 'abc'") | ||
| val insert = df.queryExecution.executedPlan.collect { | ||
| case CommandResultExec(_, dataWriting: DataWritingCommandExec, _) => dataWriting.cmd | ||
| } | ||
| assert(insert.size == 1) | ||
| assert(insert.head.metrics.contains(BasicWriteJobStatsTracker.JOB_COMMIT_TIME)) | ||
| assert(insert.head.metrics.contains(BasicWriteJobStatsTracker.TASK_COMMIT_TIME)) | ||
| assert(insert.head.metrics(BasicWriteJobStatsTracker.JOB_COMMIT_TIME).value > 0) | ||
| assert(insert.head.metrics(BasicWriteJobStatsTracker.TASK_COMMIT_TIME).value > 0) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| test("SPARK-34567: Add metrics for CTAS operator") { | ||
| withTable("t") { | ||
| val df = sql("CREATE TABLE t USING PARQUET AS SELECT 1 as a") | ||
|
|
@@ -805,3 +827,15 @@ class SQLMetricsSuite extends SharedSparkSession with SQLMetricsTestUtils | |
| } | ||
| } | ||
| } | ||
|
|
||
| case class CustomFileCommitProtocol( | ||
| jobId: String, | ||
| path: String, | ||
| dynamicPartitionOverwrite: Boolean = false) | ||
| extends SQLHadoopMapReduceCommitProtocol(jobId, path, dynamicPartitionOverwrite) { | ||
| override def commitTask( | ||
| taskContext: TaskAttemptContext): FileCommitProtocol.TaskCommitMessage = { | ||
| Thread.sleep(Random.nextInt(100)) | ||
| super.commitTask(taskContext) | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.