laskoviymishka commented on code in PR #3683:
URL: https://github.com/apache/iceberg-rust/pull/3683#discussion_r4740114585
##########
crates/iceberg/Cargo.toml:
##########
@@ -73,6 +73,7 @@ parquet = { workspace = true, features = [
"geospatial",
] }
parquet-geospatial = { workspace = true }
+parquet-variant-compute = { workspace = true }
Review Comment:
Should variant reading sit behind a cargo feature? This line puts umbrella
`arrow` (with `default-features = false`), `arrow-row` and the three
`parquet-variant*` crates into `iceberg`'s normal graph for every consumer
([Cargo.lock](https://github.com/apache/iceberg-rust/blob/a85f01da8c74f1424669f2a7e973b6666150045c/Cargo.lock#L4514-L4528)).
On `main` only `pyiceberg_core_rust` depends on `arrow` ([base
Cargo.lock](https://github.com/apache/iceberg-rust/blob/ac3bae41ffb56b8652a23fee9b41d532dd5f250b/Cargo.lock#L4844-L4848)).
The cost is small, so this is the maintainers' call.
##########
crates/iceberg/src/arrow/record_batch_transformer.rs:
##########
@@ -494,19 +555,50 @@ impl PromotePlan {
*sorted,
)?))
}
+ PromotePlan::Unshred {
+ target_type,
+ name,
+ field_id,
+ } => {
+ let (storage_fields, columns, nulls) = array
+ .as_struct_opt()
+ .ok_or_else(|| promote_err(array, "struct"))?
+ .clone()
+ .into_parts();
+ // `unshred_variant` skips null rows, so mark the rows under a
null parent as
+ // null. The output keeps the nulls of `array`, because Arrow
rejects a null in
+ // a required child of a valid row.
+ let skip = arrow_buffer::NullBuffer::union(parent_nulls,
nulls.as_ref());
+ let storage = StructArray::try_new(storage_fields, columns,
skip)?;
+ let unshredded = VariantArray::try_new(&storage)
Review Comment:
Could we add a test that pins what happens to an extra field next to
`value`/`typed_value` in a nested shredded group? As I read it,
[`validate_variant_storage`](https://github.com/apache/iceberg-rust/blob/a85f01da8c74f1424669f2a7e973b6666150045c/crates/iceberg/src/arrow/schema.rs#L120-L176)
rejects extras only at the top level, and
[`try_new_opt`](https://github.com/apache/arrow-rs/blob/b391e5af7dff9f6909af45c01f7dddb68ba08c0f/parquet-variant-compute/src/unshred_variant.rs#L239-L249)
looks up just those two columns by name, so a legal-typed extra is skipped
without an error. The description flags this; a test would catch arrow-rs
changing it.
--
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]