-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-32019][SQL] Add spark.sql.files.minPartitionNum config #28853
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
8ef9f29
4d776d3
09bba5c
8f9b1c1
7c667d8
600b933
f6d574a
8f86b42
3a646a2
1fb9dc6
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 |
|---|---|---|
|
|
@@ -528,6 +528,41 @@ 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) | ||
dongjoon-hyun marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| 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) | ||
| } | ||
|
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. can we add more tests to make sure that this is really for min partition number? e.g. we can create more partitions than the min number, as we make each partition 128mb. |
||
|
|
||
| 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) | ||
|
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.
|
||
| } | ||
|
|
||
| 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) | ||
|
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.
|
||
| } | ||
| } | ||
|
|
||
| // Helpers for checking the arguments passed to the FileFormat. | ||
|
|
||
| protected val checkPartitionSchema = | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.