saikocat commented on a change in pull request #30902:
URL: https://github.com/apache/spark/pull/30902#discussion_r550219137
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
##########
@@ -625,9 +632,24 @@ class JDBCSuite extends QueryTest
assert(cal.get(Calendar.HOUR) === 11)
assert(cal.get(Calendar.MINUTE) === 22)
assert(cal.get(Calendar.SECOND) === 33)
+ assert(cal.get(Calendar.MILLISECOND) === 543)
assert(rows(0).getAs[java.sql.Timestamp](2).getNanos === 543543000)
}
+ test("SPARK-33888 : test TIME types") {
+ val rows = spark.read.jdbc(
+ urlWithUserAndPass, "TEST.TIMETYPES", new Properties()).collect()
+ val cachedRows = spark.read.jdbc(urlWithUserAndPass, "TEST.TIMETYPES", new
Properties())
+ .cache().collect()
+ val expectedTimeRaw = java.sql.Time.valueOf("12:34:56")
+ val expectedTimeMillis = java.util.concurrent.TimeUnit.SECONDS.toMillis(
+ expectedTimeRaw.toLocalTime().toSecondOfDay()
+ ).toInt
+ assert(rows(0).getAs[java.sql.Time](0) === expectedTimeMillis)
+ assert(rows(1).getAs[java.sql.Time](0) === expectedTimeMillis)
Review comment:
Oops. The value is already converted to Int via `makeGetter` in
JdbcUtils. So these should be `getAs[Int]`. Sorry about that.
----------------------------------------------------------------
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]