jcamachor commented on a change in pull request #833: Hive JDBC Storage
Handler: Incorrect results fetched from BOOLEAN and TIMESTAMP DataType From
JDBC Data Source
URL: https://github.com/apache/hive/pull/833#discussion_r341870871
##########
File path:
jdbc-handler/src/main/java/org/apache/hive/storage/jdbc/JdbcSerDe.java
##########
@@ -217,16 +221,16 @@ public Object deserialize(Writable blob) throws
SerDeException {
break;
case DATE:
if (rowVal instanceof java.sql.Date) {
- java.sql.Date dateRowVal = (java.sql.Date) rowVal;
- rowVal = Date.ofEpochMilli(dateRowVal.getTime());
+ LocalDate localDate = ((java.sql.Date) rowVal).toLocalDate();
+ rowVal = Date.of(localDate.getYear(), localDate.getMonthValue(),
localDate.getDayOfMonth());
} else {
rowVal = Date.valueOf (rowVal.toString());
}
break;
case TIMESTAMP:
if (rowVal instanceof java.sql.Timestamp) {
- java.sql.Timestamp timestampRowVal = (java.sql.Timestamp) rowVal;
- rowVal = new Timestamp(timestampRowVal);
+ LocalDateTime localDateTime = ((java.sql.Timestamp)
rowVal).toLocalDateTime();
+ rowVal = Timestamp.ofEpochSecond(localDateTime.toEpochSecond(UTC));
Review comment:
Nanos?
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]