-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-33933][SQL] Materialize BroadcastQueryStage first to avoid broadcast timeout in AQE #30998
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1431,4 +1431,28 @@ class AdaptiveQueryExecSuite | |
| } | ||
| } | ||
| } | ||
|
|
||
| test("SPARK-33933: AQE broadcast should not timeout with slow map tasks") { | ||
|
Contributor
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. It seems that this case fails a little frequently:
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. Hmm, so it is still flaky.
Contributor
Author
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 try the test tens of times and the test failed twice. As we discussed, the guarantee is not strict since the submit of broadcast job and shuffle map job are in different thread. So there's still risk for the shuffle map job schedule earlier before broadcast job. I wonder should we need to remove the UT until we thorough resolve the issue.
Contributor
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 run
Contributor
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.
yes
Contributor
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.
This shows the test is unreliable... Checking the Spark jobs submission order should be easy to do and fast to run, and with retry it should be unlikely to fail. It's better to check stage submission order directly, if we can figure out how to do it.
Contributor
Author
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. Yes I know, the failure reported by @LuciferYang is easy to solve.
Contributor
Author
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. @cloud-fan You mean
Contributor
Author
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 am trying to create a new PR. Sorry for the inconvenience.
Contributor
Author
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. We can get the stage submission time using SparkListeneer. But after trying serval times, the stage submission time is not stable thus the UT cannot always passed. I suggest to remove the UT before we completely solve the issue. #31099 |
||
| val broadcastTimeoutInSec = 1 | ||
| val df = spark.sparkContext.parallelize(Range(0, 100), 100) | ||
| .flatMap(x => { | ||
| Thread.sleep(20) | ||
| for (i <- Range(0, 100)) yield (x % 26, x % 10) | ||
| }).toDF("index", "pv") | ||
| val dim = Range(0, 26).map(x => (x, ('a' + x).toChar.toString)) | ||
| .toDF("index", "name") | ||
| val testDf = df.groupBy("index") | ||
| .agg(sum($"pv").alias("pv")) | ||
| .join(dim, Seq("index")) | ||
| withSQLConf(SQLConf.BROADCAST_TIMEOUT.key -> broadcastTimeoutInSec.toString, | ||
| SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true") { | ||
| val startTime = System.currentTimeMillis() | ||
| val result = testDf.collect() | ||
| val queryTime = System.currentTimeMillis() - startTime | ||
| assert(result.length == 26) | ||
| // make sure the execution time is large enough | ||
| assert(queryTime > (broadcastTimeoutInSec + 1) * 1000) | ||
| } | ||
| } | ||
|
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.