hanover-fiste commented on a change in pull request #31965:
URL: https://github.com/apache/spark/pull/31965#discussion_r602115391
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
##########
@@ -433,6 +433,61 @@ class JDBCSuite extends QueryTest
assert(ids(2) === 3)
}
+ test("SPARK-34843: columnPartition should generate a correct stride size") {
+
+ val schema = StructType(Seq(
+ StructField("PartitionColumn", DateType, nullable = false)
+ ))
+
+ val numPartitions = 1000
+ val partitionConfig = Map(
+ "lowerBound" -> "1930-01-01",
+ "upperBound" -> "2020-12-31",
+ "numPartitions" -> numPartitions.toString,
+ "partitionColumn" -> "PartitionColumn"
+ )
+
+ val partitions = JDBCRelation.columnPartition(
+ schema,
+ analysis.caseInsensitiveResolution,
+ TimeZone.getDefault.toZoneId.toString,
+ new JDBCOptions(url, "table", partitionConfig)
+ )
+
+ val lastPredicate = partitions(numPartitions -
1).asInstanceOf[JDBCPartition].whereClause
+ assert(lastPredicate == """"PartitionColumn" >= '2020-08-02'""")
+ }
+
+ test("SPARK-34843: columnPartition should realign the first partition for
better distribution") {
+
Review comment:
Removed extra LF.
--
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]