[ 
https://issues.apache.org/jira/browse/SPARK-21330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sean Owen reassigned SPARK-21330:
---------------------------------

    Assignee: Andrew Ray

> Bad partitioning does not allow to read a JDBC table with extreme values on 
> the partition column
> ------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-21330
>                 URL: https://issues.apache.org/jira/browse/SPARK-21330
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.1.1
>            Reporter: Stefano Parmesan
>            Assignee: Andrew Ray
>             Fix For: 2.1.2, 2.2.1, 2.3.0
>
>
> When using "extreme" values in the partition column (like having a randomly 
> generated long number) overflow might happen, leading to the following 
> warning message:
> {code}WARN JDBCRelation: The number of partitions is reduced because the 
> specified number of partitions is less than the difference between upper 
> bound and lower bound. Updated number of partitions: -1559072469251914524; 
> Input number of partitions: 20; Lower bound: -7701345953623242445; Upper 
> bound: 9186325650834394647.{code}
> When this happens, no data is read from the table.
> This happens because of the following check in 
> {{org/apache/spark/sql/execution/datasources/jdbc/JDBCRelation.scala}}:
> {code}if ((upperBound - lowerBound) >= partitioning.numPartitions){code}
> Funny thing is that we worry about overflows a few lines later:
> {code}    // Overflow and silliness can happen if you subtract then divide.
>     // Here we get a little roundoff, but that's (hopefully) OK.{code}
> A better check would be:
> {code}if ((upperBound - partitioning.numPartitions) >= lowerBound){code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to