okumin commented on code in PR #5590:
URL: https://github.com/apache/hive/pull/5590#discussion_r1909140906
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/serde/objectinspector/IcebergTimestampObjectInspectorHive3.java:
##########
@@ -55,7 +56,13 @@ public Timestamp getPrimitiveJavaObject(Object o) {
if (o == null) {
return null;
}
- LocalDateTime time = (LocalDateTime) o;
+ LocalDateTime time;
+ if (o instanceof OffsetDateTime) {
+ OffsetDateTime odt = (OffsetDateTime) o;
+ time =
odt.atZoneSameInstant(TypeInfoFactory.timestampLocalTZTypeInfo.getTimeZone()).toLocalDateTime();
+ } else {
+ time = (LocalDateTime) o;
Review Comment:
This should always be LocalDateTime, ideally. But the Iceberg + Parquet
reader constructs OffsetDateTime. So, we should support only LocalDateTime and
OffsetDateTime.
Though we expected never fail, it could be a little kinder if we had a
better error message like `String.format("An unexpected type %s was passed as
timestamp", o.getClass)`
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]