RussellSpitzer commented on issue #11899:
URL: https://github.com/apache/iceberg/issues/11899#issuecomment-2568271032

   I think the issue here is that the Copy constructor here just do type 
checking so the accessor is failing because the Generic record has an illegal 
object in it. We should have failed when the LocalDateTime is inserted because 
that is not a valid Iceberg type that can be in a struct. We should have had a 
Long there so the correct code should be something like
   
   See here for the Java Classes used in the reference lib for various Iceberg 
Types
   
https://github.com/apache/iceberg/blob/821aec32bb9be28d9c1905f772d9e3101cc98d9e/api/src/main/java/org/apache/iceberg/types/Type.java#L31-L49
   
   ```java
           LocalDateTime val = LocalDateTime.parse("2024-10-08T13:18:20.053");
           Long epochMicros = ChronoUnit.MICROS.between(Instant.EPOCH, val);
           Record rec = GenericRecord.create(schema).copy(
           ImmutableMap.of(
                   "year", epochMicros, 
                   "day", epochMicros));
   ```


-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to