Github user bomeng commented on a diff in the pull request:
https://github.com/apache/spark/pull/12739#discussion_r61342768
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRelation.scala
---
@@ -54,15 +54,22 @@ private[sql] object JDBCRelation {
def columnPartition(partitioning: JDBCPartitioningInfo):
Array[Partition] = {
if (partitioning == null) return Array[Partition](JDBCPartition(null,
0))
+ // make sure the input is valid
+ val lower = partitioning.lowerBound
+ val upper = partitioning.upperBound
val numPartitions = partitioning.numPartitions
val column = partitioning.column
+ require(lower < upper, "lower bound must be less than upper bound")
+ require(numPartitions > 0, "number of partition must be great than
zero")
+
if (numPartitions == 1) return Array[Partition](JDBCPartition(null, 0))
- // Overflow and silliness can happen if you subtract then divide.
- // Here we get a little roundoff, but that's (hopefully) OK.
- val stride: Long = (partitioning.upperBound / numPartitions
- - partitioning.lowerBound / numPartitions)
+
+ val stride: Long = {
--- End diff --
Cool, I will update it shortly.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]