mbutrovich commented on code in PR #3632:
URL: https://github.com/apache/iceberg-rust/pull/3632#discussion_r4667133122
##########
crates/iceberg/src/arrow/int96.rs:
##########
@@ -44,66 +50,69 @@ use crate::{Error, ErrorKind};
pub(crate) fn coerce_int96_timestamps(
arrow_schema: &ArrowSchemaRef,
iceberg_schema: &Schema,
-) -> Option<Arc<ArrowSchema>> {
- let mut visitor = Int96CoercionVisitor::new(iceberg_schema);
- let coerced = visit_schema(arrow_schema, &mut visitor).ok()?;
- if visitor.changed {
- Some(Arc::new(coerced))
- } else {
- None
+ parquet_schema: &SchemaDescriptor,
+) -> Result<Option<Arc<ArrowSchema>>> {
+ if !parquet_schema
+ .columns()
+ .iter()
+ .any(|column| column.physical_type() == PhysicalType::INT96)
+ {
+ return Ok(None);
}
+ let mut visitor = Int96CoercionVisitor::new(iceberg_schema,
parquet_schema);
+ let coerced = visit_schema(arrow_schema, &mut visitor)?;
Review Comment:
> This visits the entire file before projection, so an unselected list can
now prevent an unrelated column from being read.
The `?` here came from my suggestion in
https://github.com/apache/iceberg-rust/pull/3632#discussion_r4515807780. I
missed that the visit covers columns the scan never selects.
> The end-to-end regression test covers both list-view types: selecting only
`id` returns 42, and selecting `ts, id` also verifies that the following INT96
column is coerced correctly.
I read the same file without embedded field IDs, through a name mapping
(`items` = 3 with `element` = 4, `ts` = 1, `id` = 2), and both projections
match the expected batches. Could `test_read_int96_with_unselected_list_views`
take `with_field_ids` like
`test_read_int64_nanosecond_timestamps_as_microseconds` does, so it covers the
name-mapping path that migrated files take?
--
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]