saikocat commented on a change in pull request #30902:
URL: https://github.com/apache/spark/pull/30902#discussion_r549243088



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala
##########
@@ -409,8 +410,25 @@ object JdbcUtils extends Logging {
         row.setFloat(pos, rs.getFloat(pos + 1))
 
     case IntegerType =>
-      (rs: ResultSet, row: InternalRow, pos: Int) =>
-        row.setInt(pos, rs.getInt(pos + 1))
+      (rs: ResultSet, row: InternalRow, pos: Int) => {
+        val columnIdx = pos + 1
+        // SPARK-33888 - sql TIME type represents as physical int in millis
+        // Represents a time of day, with no reference to a particular 
calendar,
+        // time zone or date, with a precision of one millisecond.
+        // It stores the number of milliseconds after midnight, 00:00:00.000.
+        if (rs.getMetaData.getColumnType(columnIdx) == java.sql.Types.TIME) {

Review comment:
       Yes. You're right.
   
   Originally, I  made changes to private method `makeGetters` and pass in the 
`ResultSetMetadata` as additional parameter. Then we have a separate pattern 
matching for `case IntegerType if rsMetadata.getColumnType(columnIdx) == TIME 
=>`  But right now, the column index/position is not accessible at the pattern 
matching level, only available at the closure function :(
   
   Any advice is deeply appreciated here.




----------------------------------------------------------------
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]

Reply via email to