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

Implement Default,Extend and FromIterator for BufferBuilder #4638

Merged
merged 2 commits into from
Aug 4, 2023

Conversation

mbrobbel
Copy link
Contributor

@mbrobbel mbrobbel commented Aug 3, 2023

Which issue does this PR close?

None.

Rationale for this change

Provide additional methods to construct and extend these builders.

What changes are included in this PR?

Trait implementations of Default (an empty buffer),Extend (extend the underlying buffer, update the length) and FromIterator (create a default builder and extend it) for BufferBuilder.

Are there any user-facing changes?

Yes, users can now use these traits with BufferBuilder.

@github-actions github-actions bot added the arrow Changes to the arrow crate label Aug 3, 2023
@@ -191,8 +191,7 @@ impl<T: ArrowNativeType> BufferBuilder<T> {
#[inline]
pub fn append(&mut self, v: T) {
self.reserve(1);
self.buffer.push(v);
self.len += 1;
self.extend(iter::once(v));
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, for a simply one item append, push seems more efficient?

@tustvold tustvold merged commit b15838c into apache:master Aug 4, 2023
25 checks passed
@mbrobbel mbrobbel deleted the buffer-builder-traits branch August 4, 2023 16:38
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.

None yet

3 participants