File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
main/scala/org/apache/spark/sql/execution/datasources/jdbc
test/scala/org/apache/spark/sql/jdbc Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -239,7 +239,7 @@ object JdbcUtils extends Logging {
239239 case java.sql.Types .TIMESTAMP => TimestampType
240240 case java.sql.Types .TIMESTAMP_WITH_TIMEZONE
241241 => null
242- case java.sql.Types .TINYINT => IntegerType
242+ case java.sql.Types .TINYINT => ByteType
243243 case java.sql.Types .VARBINARY => BinaryType
244244 case java.sql.Types .VARCHAR => StringType
245245 case _ =>
@@ -456,6 +456,10 @@ object JdbcUtils extends Logging {
456456 (rs : ResultSet , row : InternalRow , pos : Int ) =>
457457 row.update(pos, rs.getBytes(pos + 1 ))
458458
459+ case ByteType =>
460+ (rs : ResultSet , row : InternalRow , pos : Int ) =>
461+ row.update(pos, rs.getByte(pos + 1 ))
462+
459463 case ArrayType (et, _) =>
460464 val elementConversion = et match {
461465 case TimestampType =>
Original file line number Diff line number Diff line change @@ -572,7 +572,7 @@ class JDBCSuite extends QueryTest
572572 assert(rows.length === 1 )
573573 assert(rows(0 ).getInt(0 ) === 1 )
574574 assert(rows(0 ).getBoolean(1 ) === false )
575- assert(rows(0 ).getInt (2 ) === 3 )
575+ assert(rows(0 ).getByte (2 ) === 3 )
576576 assert(rows(0 ).getInt(3 ) === 4 )
577577 assert(rows(0 ).getLong(4 ) === 1234567890123L )
578578 }
You can’t perform that action at this time.
0 commit comments