ahmedabu98 commented on code in PR #32688:
URL: https://github.com/apache/beam/pull/32688#discussion_r1792697291


##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/IcebergUtils.java:
##########
@@ -282,12 +306,24 @@ private static void copyFieldIntoRecord(Record rec, 
Types.NestedField field, Row
         Optional.ofNullable(value.getDouble(name)).ifPresent(v -> 
rec.setField(name, v));
         break;
       case DATE:
-        throw new UnsupportedOperationException("Date fields not yet 
supported");
+        Optional.ofNullable(value.getLogicalTypeValue(name, LocalDate.class))
+            .ifPresent(v -> rec.setField(name, v));
+        break;
       case TIME:
-        throw new UnsupportedOperationException("Time fields not yet 
supported");
+        Optional.ofNullable(value.getLogicalTypeValue(name, LocalTime.class))
+            .ifPresent(v -> rec.setField(name, v));
+        break;
       case TIMESTAMP:
-        Optional.ofNullable(value.getDateTime(name))
-            .ifPresent(v -> rec.setField(name, v.getMillis()));
+        Object val = value.getValue(name);
+        if (val instanceof Instant) { // case Schema.FieldType.DATETIME
+          rec.setField(name, DateTimeUtil.timestampFromMicros(((Instant) 
val).getMillis()));

Review Comment:
   Actually we might be able to support it by letting the user provide String 
timestamp representations. We can parse these strings into date time objects 
then write to Iceberg. Will look into this route soon



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

Reply via email to