Skip to content

Commit d986fb9

Browse files
rtrefferrxin
authored andcommitted
[SPARK-7897] Improbe type for jdbc/"unsigned bigint"
The original fix uses DecimalType.Unlimited, which is harder to handle afterwards. There is no scale and most data should fit into a long, thus DecimalType(20,0) should be better. Author: Rene Treffer <[email protected]> Closes apache#6789 from rtreffer/spark-7897-unsigned-bigint-as-decimal and squashes the following commits: 2006613 [Rene Treffer] Fix type for "unsigned bigint" jdbc loading.
1 parent 4aed66f commit d986fb9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/core/src/main/scala/org/apache/spark/sql/jdbc/JDBCRDD.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private[sql] object JDBCRDD extends Logging {
5555
val answer = sqlType match {
5656
// scalastyle:off
5757
case java.sql.Types.ARRAY => null
58-
case java.sql.Types.BIGINT => if (signed) { LongType } else { DecimalType.Unlimited }
58+
case java.sql.Types.BIGINT => if (signed) { LongType } else { DecimalType(20,0) }
5959
case java.sql.Types.BINARY => BinaryType
6060
case java.sql.Types.BIT => BooleanType // @see JdbcDialect for quirks
6161
case java.sql.Types.BLOB => BinaryType

0 commit comments

Comments
 (0)