-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-29655][SQL] Read bucketed tables obeys spark.sql.shuffle.partitions #26409
Closed
Closed
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
16e8f5b
Enable adaptive execution should not add ShuffleExchange
wangyum 1ba9edf
Fix test error
wangyum 45109c7
Ignores Thrift server ThriftServerPageSuite
wangyum 73a4943
Read bucketed tables obeys numShufflePartitions
wangyum 59afeab
Address comment
wangyum 8ec1518
Remove toSet
wangyum a50122b
Add comment
wangyum 57c50b8
Fix test error: org.apache.spark.sql.execution.ReduceNumShufflePartit…
wangyum a4f7611
Fix test error
wangyum eb4f65f
Update comment
wangyum 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 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 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 |
---|---|---|
|
@@ -28,6 +28,7 @@ import org.apache.spark.sql.catalyst.expressions | |
import org.apache.spark.sql.catalyst.expressions._ | ||
import org.apache.spark.sql.catalyst.plans.physical.HashPartitioning | ||
import org.apache.spark.sql.execution.{DataSourceScanExec, SortExec} | ||
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanExec | ||
import org.apache.spark.sql.execution.datasources.BucketingUtils | ||
import org.apache.spark.sql.execution.exchange.ShuffleExchangeExec | ||
import org.apache.spark.sql.execution.joins.SortMergeJoinExec | ||
|
@@ -382,8 +383,16 @@ abstract class BucketedReadSuite extends QueryTest with SQLTestUtils { | |
joined.sort("bucketed_table1.k", "bucketed_table2.k"), | ||
df1.join(df2, joinCondition(df1, df2), joinType).sort("df1.k", "df2.k")) | ||
|
||
assert(joined.queryExecution.executedPlan.isInstanceOf[SortMergeJoinExec]) | ||
val joinOperator = joined.queryExecution.executedPlan.asInstanceOf[SortMergeJoinExec] | ||
val joinOperator = if (joined.sqlContext.conf.adaptiveExecutionEnabled) { | ||
val executedPlan = | ||
joined.queryExecution.executedPlan.asInstanceOf[AdaptiveSparkPlanExec].executedPlan | ||
assert(executedPlan.isInstanceOf[SortMergeJoinExec]) | ||
executedPlan.asInstanceOf[SortMergeJoinExec] | ||
} else { | ||
val executedPlan = joined.queryExecution.executedPlan | ||
assert(executedPlan.isInstanceOf[SortMergeJoinExec]) | ||
executedPlan.asInstanceOf[SortMergeJoinExec] | ||
} | ||
|
||
// check existence of shuffle | ||
assert( | ||
|
@@ -795,4 +804,22 @@ abstract class BucketedReadSuite extends QueryTest with SQLTestUtils { | |
} | ||
} | ||
|
||
test("Read bucketed tables obeys numShufflePartitions") { | ||
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. let's add the JIRA ID in the test name as this is a regression |
||
withSQLConf( | ||
SQLConf.SHUFFLE_PARTITIONS.key -> "5", | ||
SQLConf.SHUFFLE_MAX_NUM_POSTSHUFFLE_PARTITIONS.key -> "7") { | ||
val bucketSpec = Some(BucketSpec(6, Seq("i", "j"), Nil)) | ||
Seq(false, true).foreach { enableAdaptive => | ||
withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> s"$enableAdaptive") { | ||
val bucketedTableTestSpecLeft = BucketedTableTestSpec(bucketSpec, expectedShuffle = false) | ||
val bucketedTableTestSpecRight = BucketedTableTestSpec(None, expectedShuffle = true) | ||
testBucketing( | ||
bucketedTableTestSpecLeft = bucketedTableTestSpecLeft, | ||
bucketedTableTestSpecRight = bucketedTableTestSpecRight, | ||
joinCondition = joinCondition(Seq("i", "j")) | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
childrenIndexes.map(children).filterNot(_.isInstanceOf[ShuffleExchangeExec])...