-
Notifications
You must be signed in to change notification settings - Fork 839
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 Extend for ArrayBuilder (#1841) #3563
Implement Extend for ArrayBuilder (#1841) #3563
Conversation
/// # Panics | ||
/// | ||
/// Panics if the resulting length of the dictionary values array would exceed `T::Native::MAX` | ||
pub fn append_value(&mut self, value: impl AsRef<T::Native>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the new APIs for #3562
What's the benefit of this over including an |
https://github.com/apache/arrow-rs/pull/3563/files#diff-cb5b791e20e4536940eecb1466e034510c245d0d443fb89942b8ab94171693c8R192 is an example of a use-case that isn't possible without some sort of statically typed trait abstraction, using the standard ecosystem primitive seems better than rolling our own. Any sort of composite builder, be it ListArray or some custom builder for a custom struct, stands to benefit from this |
} | ||
}); | ||
|
||
builder.extend(it); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is certainly nicer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me -- thank you @tustvold
The only thing that might be worth doing is some sort of test coverage (as you have done for ListArray) so that extend
can't be removed by accident without also changing tests (aka so we don't break them by accident)
@@ -364,4 +390,25 @@ mod tests { | |||
list_array.values().data().child_data()[0].buffers()[0].clone() | |||
); | |||
} | |||
|
|||
#[test] | |||
fn test_extend() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thank you for this test
Benchmark runs are scheduled for baseline = a1cedb4 and contender = 19e3e8c. 19e3e8c is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
Closes #1841
Closes #3562
Rationale for this change
What changes are included in this PR?
Are there any user-facing changes?