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

BinaryBuilder and StringBuilder initialization parameters in struct_builder may be wrong #2783

Closed
chunshao90 opened this issue Sep 27, 2022 · 0 comments · Fixed by #2784
Closed
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog

Comments

@chunshao90
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
BinaryBuilder and StringBuilder initialization parameters in struct_builder may be wrong.

DataType::Binary => Box::new(BinaryBuilder::with_capacity(1024, capacity)),

DataType::Utf8 => Box::new(StringBuilder::with_capacity(1024, capacity)),

Refor to with_capacity() of BinaryBuilder and StringBuilder, the first parameter is item_capacity and the second parameter is data_capacity.

/// - `item_capacity` is the number of items to pre-allocate.

/// - `item_capacity` is the number of items to pre-allocate.

Describe the solution you'd like

We need to swap parameters, which means preallocating 1kB of data value buffer.

BinaryBuilder::with_capacity(capacity, 1024)
StringBuilder::with_capacity(capacity, 1024)

Describe alternatives you've considered

Additional context

@chunshao90 chunshao90 added the enhancement Any new improvement worthy of a entry in the changelog label Sep 27, 2022
@alamb alamb added the arrow Changes to the arrow crate label Sep 30, 2022
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 enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants