mbutrovich commented on code in PR #3467:
URL: https://github.com/apache/iceberg-rust/pull/3467#discussion_r4671506217
##########
crates/iceberg/src/arrow/reader/projection.rs:
##########
@@ -860,9 +850,13 @@ fn apply_name_mapping_to_field(
.with_data_type(DataType::Struct(entry_fields));
DataType::Map(Arc::new(entries), *sorted)
}
- // `Fields::filter_leaves` treats `ListView` and `LargeListView` as
leaves, so projection
- // cannot select their elements even with IDs.
- other => other.clone(),
+ other => {
+ debug_assert!(
+ !matches!(other, DataType::ListView(_) |
DataType::LargeListView(_)),
+ "`coerce_list_layouts` must rewrite list views before name
mapping"
+ );
+ other.clone()
+ }
Review Comment:
This builds on
https://github.com/apache/iceberg-rust/pull/3467#discussion_r4323674439. The
`debug_assert!` catches a new call site in tests, but a release build still
lets the list view through and reads `lv` as empty lists without an error. I
checked that by passing the original hint to
`apply_name_mapping_to_arrow_schema` in `pipeline.rs` and removing the assert,
which is what a release build runs. `test_read_list_view_columns` then fails
with offsets `[0, 0, 0, 0]` instead of `[0, 1, 2, 3]`.
This function already returns `Result`, and the `Map` arm above reports a
bad shape with
[`invalid_data!`](https://github.com/apache/iceberg-rust/blob/33c4193c5e27e6702e1ee61d046e36e1bad5cd09/crates/iceberg/src/arrow/reader/projection.rs#L829-L835).
Could the list view arms return an error the same way? Then a call site that
skips `coerce_list_layouts` fails in every build. The only non-test caller runs
the rewrite first, so no read that works today starts failing. The PR
description bullet about the debug assert would change to match.
```suggestion
DataType::ListView(_) | DataType::LargeListView(_) => {
return Err(invalid_data!(
"List view field `{}` must be rewritten to a list before
name mapping",
field.name()
));
}
other => other.clone(),
```
--
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]