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


##########
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:
   You may want to take a look at how Iceberg implemented it for the Spark 
Runtime. 
   
   [Iceberg Spark Timestamp 
conversions](https://github.com/apache/iceberg/blob/208ab20dc9ab8bcab3ee525d0ddaba80eeae7609/spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/SparkValueConverter.java#L138)



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