Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for building FixedSizeListBuilder in struct_builder's mak… #6595

Merged
merged 4 commits into from
Oct 21, 2024

Conversation

kszlim
Copy link
Contributor

@kszlim kszlim commented Oct 20, 2024

…e_builders

Which issue does this PR close?

Closes #6594 .

Rationale for this change

Makees make_builders more flexible/useful

What changes are included in this PR?

Adds support for FixedSizeList builders in make_builders

Are there any user-facing changes?

No API changes, but users will be able to successfully construct FixedSizeList builders.

@github-actions github-actions bot added the arrow Changes to the arrow crate label Oct 20, 2024
@kszlim
Copy link
Contributor Author

kszlim commented Oct 20, 2024

Please feel free to change anything required to merge this in

Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get a test please

@@ -253,6 +253,13 @@ pub fn make_builder(datatype: &DataType, capacity: usize) -> Box<dyn ArrayBuilde
let builder = make_builder(field.data_type(), capacity);
Box::new(LargeListBuilder::with_capacity(builder, capacity).with_field(field.clone()))
}
DataType::FixedSizeList(field, size) => {
let builder = make_builder(field.data_type(), capacity);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be capacity*size

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm are you sure, @tustvold I followed the pattern for the above Listbuilder, seems like either that's wrong too or this is right.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ListBuilder doesn't have a fixed size

@kszlim
Copy link
Contributor Author

kszlim commented Oct 20, 2024

Can we get a test please

Sounds good, I was following the pattern in the rest of the code, it didn't seem like there were tests for every builder type.

@kszlim
Copy link
Contributor Author

kszlim commented Oct 21, 2024

@tustvold made your suggested changes

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me -- thank you @kszlim

let size: usize = size.try_into().unwrap();
capacity * size
};
let builder = make_builder(field.data_type(), values_builder_capacity);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alamb alamb merged commit 6762d0b into apache:master Oct 21, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support DataType::FixedSizeList in make_builder within struct_builder.rs
3 participants