Repository navigation
Conversation
mbutrovich
left a comment
There was a problem hiding this comment.
Thanks @swanandx for picking this up so soon after #2880. I updated apache/datafusion-comet#7575 to run this change through Comet's native Iceberg scan, backported to arrow 59, and added a CometIcebergNativeSuite test that reads Spark-shredded files natively. Locally, that test and the suite's other variant tests pass, and so do all 29 of Iceberg 1.11's TestVariantShredding tests, where 7 fail with #2880 alone.
| children: &[ChildPlan], | ||
| parent_nulls: Option<&arrow_buffer::NullBuffer>, | ||
| ) -> Result<StructArray> { | ||
| let nulls = arrow_buffer::NullBuffer::union(parent_nulls, source.nulls()); |
There was a problem hiding this comment.
This union now runs for every struct the transformer promotes. When a struct and one of its ancestors both have nulls, NullBuffer::union allocates a new bitmap for each batch, even when no variant is below the struct. Only the Unshred arm reads parent_nulls. Could we compute the union only when a child needs it? One way is a flag on PromotePlan::Struct, set when the plan is built if a descendant is Unshred.
There was a problem hiding this comment.
done with an unshred_below flag, set at plan build.
laskoviymishka
left a comment
There was a problem hiding this comment.
Thanks @swanandx for running this against the full TestVariantShredding suite. Agreed with @mbutrovich on both of his threads: an end-to-end read with value omitted plus a shredded map value, and computing the NullBuffer::union only when a descendant is Unshred. His review is the gate here, so I'd like his sign-off before this goes in. My two comments are small ones on the unshred error.
Merge `typed_value` back into `value` with arrow-rs `unshred_variant`. Also skip variant leaves in the INT96 coercion, and skip null struct rows when a required variant is unshredded. Signed-off-by: Swanand Mulay <[email protected]>
Compute the parent null union only for structs with a shredded variant below them. Attach the arrow error as the source of the unshred error. Add read tests for a shredded variant with no `value` and for one in a map value.
9964df4 to
a85f01d
Compare
Merge
typed_valueback intovaluewith arrow-rsunshred_variant. Also skip variant leaves in the INT96 coercion, and skip null struct rows when a required variant is unshredded.Which issue does this PR close?
What changes are included in this PR?
The reader can now read shredded variant columns. It uses arrow-rs
unshred_variantto mergetyped_valueback intovalue. The caller gets the same rows as from an unshredded column.Before this PR, two more cases stopped the read of a shredded file with an error. This PR also corrects these cases:
This PR adds the dependency
parquet-variant-compute.Are these changes tested?
Yes:
TestVariantShreddingpass with the Comet Iceberg 1.11 / Spark 4.1 suite. Without this PR, 7 of these tests stop withFeatureUnsupported.AI Disclosure
I used Claude Code to write the code, the tests. I read the full diff and did the tests that this description gives.
Examine these areas:
unshred_variant. arrow-rs marks its variant support as experimental.unshred_variantignores unknown fields in nested shredded groups.