emkornfield commented on code in PR #2301:
URL: https://github.com/apache/iceberg-rust/pull/2301#discussion_r3017276758
##########
crates/iceberg/src/arrow/reader.rs:
##########
@@ -386,6 +386,27 @@ impl ArrowReader {
arrow_metadata
};
+ // Coerce INT96 timestamp columns to the resolution specified by the
Iceberg schema.
+ // This must happen before building the stream reader to avoid i64
overflow in arrow-rs.
+ let arrow_metadata = if let Some(coerced_schema) =
coerce_int96_timestamps(
+ arrow_metadata.metadata().file_metadata().schema_descr(),
+ arrow_metadata.schema(),
+ &task.schema,
+ ) {
+ let options =
ArrowReaderOptions::new().with_schema(coerced_schema);
+
ArrowReaderMetadata::try_new(Arc::clone(arrow_metadata.metadata()),
options).map_err(
+ |e| {
+ Error::new(
+ ErrorKind::Unexpected,
+ "Failed to create ArrowReaderMetadata with
INT96-coerced schema",
Review Comment:
should we include the coerced schema or something else to help debug?
--
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]