grantatspothero opened a new pull request #1848:
URL: https://github.com/apache/iceberg/pull/1848


   Currently trying to convert avro schemas to iceberg schemas fails for avro 
schemas containing timestamps but without the `adjust-to-utc` annotations. 
   
   ```
   val icebergSchema = AvroSchemaUtil.toIceberg(avroSchema)
   Exception in thread "main" java.lang.IllegalArgumentException: Invalid value 
for adjust-to-utc: null
        at 
org.apache.iceberg.relocated.com.google.common.base.Preconditions.checkArgument(Preconditions.java:217)
        at org.apache.iceberg.avro.SchemaToType.primitive(SchemaToType.java:185)
   ```
   
   The [avro 
spec](https://avro.apache.org/docs/current/spec.html#Timestamp+%28microsecond+precision%29)
 says the `timestamp-millis` and `timestamp-micros` types represent an instant 
on the global timeline, and this aligns with the [timestamp iceberg 
type](https://iceberg.apache.org/spec/#schemas-and-data-types). Thus, if 
`adjust-to-utc` is not configured then instead of failing we default to the 
`timestamp` iceberg type. 
   
   Slack thread for context: 
   https://the-asf.slack.com/archives/CF01LKV9S/p1605902467354000
   
   Note:  I did not add support for the new avro types 
(`local-timestamp-millis/micros`) in this PR, but that would be a good next 
pass. 
   


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