Repository navigation
[Arrow] Move parquet-variant-compute StructArrayAssembler to arrow-array - #10636
Conversation
Rich-T-kid
left a comment
There was a problem hiding this comment.
This PR make sense to me.A big plus is we aren't introducing another dependency to parquet-variant-compute since it already used arrow-array. thanks @cakeni
Jefffrey
left a comment
There was a problem hiding this comment.
i do wonder if we should be adding this to our public api 🤔
it is simple enough, but could be slightly confusing as it doesnt follow our other builder patterns
|
I kept this separate from |
c1581e8 to
b288c5e
Compare
b288c5e to
3f3dba9
Compare
The new API: let array = StructArrayBuilder::new()
.with_field("name", names, false)
.with_field("value", values, false)
.with_nulls(nulls)
.build()?;is just syntactic sugar and lets us create let name_field = Arc::new(Field::new(
"name",
names.data_type().clone(),
false,
));
let value_field = Arc::new(Field::new(
"value",
values.data_type().clone(),
false,
));
let array = StructArray::from(vec![
(name_field, names),
(value_field, values),
]);It's more functional/idiomatic and would be nice to have.
I suggest using a different name to disambiguate it -- |
+1 in my opinion |
alamb
left a comment
There was a problem hiding this comment.
Looks great to me -- thanks @sdf-jkl and @Rich-T-kid
Since this struct appears not to be part of the public API
pub(crate) struct StructArrayBuilder {I don't think we have to worry about backwards compatibility / wait for the next major release.
|
Where did we land on this API -- should we call it something different (maybe "Assembler") ? |
|
If everyone's good with @cakeni please LMK if you have the bandwidth to work on this |
This sounds good to me, but we should confirm with @Jefffrey |
|
this sounds reasonable |
|
Updated the remaining docs comments. |
|
Thanks @cakeni 🙏 |
…-metadata Resolve the conflict with apache#12092, which removed `TopLevelRowSink`, and switch the tests from `StructArrayBuilder` to `StructArrayAssembler`, which moved to arrow-array in apache#10636. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Which issue does this PR close?
Rationale for this change
parquet-variant-computecontains a local helper for assembling aStructArrayfrom completed child arrays. The helper is generally useful Arrow functionality and should live inarrow-arrayinstead of being duplicated in a Variant-specific crate.What changes are included in this PR?
StructArrayAssemblerfor completed child arrays toarrow-array.FieldRefvalues that retain metadata, and an optional top-level null buffer.parquet-variant-computeimplementation with the shared assembler.Are these changes tested?
Yes.
cargo test -p arrow-array struct_array_assembler(16 tests passed)cargo test -p parquet-variant-compute(347 unit tests and 13 doctests passed)Are there any user-facing changes?
Yes.
arrow-arrayexposes a new assembler API for assemblingStructArrayvalues from completed children. Existing APIs are unchanged.AI assistance
I investigated the existing builder design, determined the scope of the API extraction, and reviewed and refined the resulting API and implementation. OpenAI Codex assisted with code exploration, drafting, and test preparation.