pvary commented on a change in pull request #1455:
URL: https://github.com/apache/iceberg/pull/1455#discussion_r487862503
##########
File path:
mr/src/main/java/org/apache/iceberg/mr/hive/serde/objectinspector/IcebergDateObjectInspector.java
##########
@@ -42,17 +42,17 @@ private IcebergDateObjectInspector() {
@Override
public Date getPrimitiveJavaObject(Object o) {
- return o == null ? null : Date.valueOf((LocalDate) o);
+ return o == null ? null : Date.valueOf(o.toString());
}
@Override
- public DateWritable getPrimitiveWritableObject(Object o) {
- return o == null ? null : new
DateWritable(DateTimeUtil.daysFromDate((LocalDate) o));
+ public DateWritableV2 getPrimitiveWritableObject(Object o) {
+ return o == null ? null : new
DateWritableV2(DateTimeUtil.daysFromDate((LocalDate) o));
}
@Override
public Object copyObject(Object o) {
- return o == null ? null : new Date(((Date) o).getTime());
+ return o == null ? null : Date.valueOf(o.toString());
Review comment:
Good catch!
The data object used by Hive internally for storing Date is changed, so
instanceOf should be used to handle the differences between the two Date
implementations.
----------------------------------------------------------------
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]