-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-32970][SQL][TEST] Reduce the runtime of an UT for SPARK-32019 #29842
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 1 commit
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 |
|---|---|---|
|
|
@@ -529,37 +529,39 @@ class FileSourceStrategySuite extends QueryTest with SharedSparkSession with Pre | |
| } | ||
|
|
||
| test("SPARK-32019: Add spark.sql.files.minPartitionNum config") { | ||
| withSQLConf(SQLConf.FILES_MIN_PARTITION_NUM.key -> "1") { | ||
| val table = | ||
| createTable(files = Seq( | ||
| "file1" -> 1, | ||
| "file2" -> 1, | ||
| "file3" -> 1 | ||
| )) | ||
| assert(table.rdd.partitions.length == 1) | ||
| } | ||
| withSQLConf(SQLConf.FILES_MAX_PARTITION_BYTES.key -> "2MB") { | ||
| withSQLConf(SQLConf.FILES_MIN_PARTITION_NUM.key -> "1") { | ||
|
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 think it is okay just to update the slow two tests only in this PR.
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. Done |
||
| val table = | ||
| createTable(files = Seq( | ||
| "file1" -> 1, | ||
| "file2" -> 1, | ||
| "file3" -> 1 | ||
| )) | ||
| assert(table.rdd.partitions.length == 3) | ||
| } | ||
|
|
||
| withSQLConf(SQLConf.FILES_MIN_PARTITION_NUM.key -> "10") { | ||
| val table = | ||
| createTable(files = Seq( | ||
| "file1" -> 1, | ||
| "file2" -> 1, | ||
| "file3" -> 1 | ||
| )) | ||
| assert(table.rdd.partitions.length == 3) | ||
| } | ||
| withSQLConf(SQLConf.FILES_MIN_PARTITION_NUM.key -> "10") { | ||
| val table = | ||
| createTable(files = Seq( | ||
| "file1" -> 1, | ||
| "file2" -> 1, | ||
| "file3" -> 1 | ||
| )) | ||
| assert(table.rdd.partitions.length == 3) | ||
| } | ||
|
|
||
| withSQLConf(SQLConf.FILES_MIN_PARTITION_NUM.key -> "16") { | ||
| val partitions = (1 to 100).map(i => s"file$i" -> 128 * 1024 * 1024) | ||
| val table = createTable(files = partitions) | ||
| // partition is limited by filesMaxPartitionBytes(128MB) | ||
| assert(table.rdd.partitions.length == 100) | ||
| } | ||
| withSQLConf(SQLConf.FILES_MIN_PARTITION_NUM.key -> "8") { | ||
| val partitions = (1 to 12).map(i => s"file$i" -> 2 * 1024 * 1024) | ||
| val table = createTable(files = partitions) | ||
| // partition is limited by filesMaxPartitionBytes(2MB) | ||
| assert(table.rdd.partitions.length == 12) | ||
| } | ||
|
|
||
| withSQLConf(SQLConf.FILES_MIN_PARTITION_NUM.key -> "32") { | ||
| val partitions = (1 to 800).map(i => s"file$i" -> 4 * 1024 * 1024) | ||
| val table = createTable(files = partitions) | ||
| assert(table.rdd.partitions.length == 50) | ||
| withSQLConf(SQLConf.FILES_MIN_PARTITION_NUM.key -> "8") { | ||
|
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.
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. Sure |
||
| val partitions = (1 to 12).map(i => s"file$i" -> 4 * 1024 * 1024) | ||
| val table = createTable(files = partitions) | ||
| assert(table.rdd.partitions.length == 24) | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
Can we add the config
spark.sql.files.openCostInBytes? The result is based on it although we don't change the default value.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.
Done