ulysses-you commented on a change in pull request #28853:
URL: https://github.com/apache/spark/pull/28853#discussion_r442784986
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/FileSourceStrategySuite.scala
##########
@@ -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)
+ }
+
+ 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 limit by filesMaxPartitionBytes(128MB)
+ assert(table.rdd.partitions.length == 100)
Review comment:
`100 * 128 / 16 > 128`, so max partition size is 128, partition number
== file number.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]