You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "rluvaton (via GitHub)" <gi...@apache.org> on 2026/09/24 11:00:45 UTC
[PR] feat: add `bit_util::copy_bits_within` and `BooleanBufferBuilder::copy_within` [arrow-rs]
rluvaton opened a new pull request, #11196:
URL: https://github.com/apache/arrow-rs/pull/11196
# Which issue does this PR close?
None
# Rationale for this change
Allow to copy within bits like Vec::copy_within
# What changes are included in this PR?
added `bit_util::copy_bits_within` and `BooleanBufferBuilder::copy_within`
# Are these changes tested?
Yes
# Are there any user-facing changes?
new public function
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: add `bit_util::copy_bits_within` and `{BooleanBufferBuilder, NullBufferBuilder}::copy_within` [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #11196:
URL: https://github.com/apache/arrow-rs/pull/11196#issuecomment-6006764725
yeah i just wanted to see if we already have planned concrete uses for these APIs (downstream in datafusion), which would help justify adding these (especially `copy_bits_within` from bit_util). i can see the linked epic but thats a bit broad
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: add `bit_util::copy_bits_within` and `{BooleanBufferBuilder, NullBufferBuilder}::copy_within` [arrow-rs]
Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton commented on PR #11196:
URL: https://github.com/apache/arrow-rs/pull/11196#issuecomment-5829155569
Take n in datafusion aggregate
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: add `bit_util::copy_bits_within` and `{BooleanBufferBuilder, NullBufferBuilder}::copy_within` [arrow-rs]
Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton commented on PR #11196:
URL: https://github.com/apache/arrow-rs/pull/11196#issuecomment-5978539649
> PR looks good to me, just would like to understand the use case a bit better, especially for `copy_bits_within`, so i can see for what purpose we're making it public
when you need to shift bits to the start, you can use `copy_within` and then `truncate`, but basically, because BooleanBufferBuilder is the entrypoint to build bit-packed booleans, I think having API functions similar to `Vec` is useful
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: add `bit_util::copy_bits_within` and `{BooleanBufferBuilder, NullBufferBuilder}::copy_within` [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #11196:
URL: https://github.com/apache/arrow-rs/pull/11196#discussion_r4102369312
##########
arrow-buffer/src/builder/boolean.rs:
##########
@@ -312,6 +312,27 @@ impl BooleanBufferBuilder {
self.append_packed_range(range, buffer.values())
}
+ /// Copies bits `src` of `data` to position `dest`
+ ///
+ /// # Arguments
+ /// * `src` - The source range of bits to copy
+ /// * `dest` - The destination bit index to copy to
+ ///
+ /// # Example
+ /// ```
+ /// # use arrow_buffer::BooleanBufferBuilder;
+ /// let mut builder = BooleanBufferBuilder::new(0);
+ /// builder.append_slice(&[true, false, false, false, false, true]);
+ /// // Copy values 4.. to position 1
+ /// builder.copy_within(4.., 1);
+ ///
+ /// let output = builder.build().iter().collect::<Vec<_>>();
+ /// assert_eq!(output, vec![true, false, true, false, false, true]);
+ /// ```
+ pub fn copy_within<R: RangeBounds<usize>>(&mut self, src: R, dest: usize) {
Review Comment:
should this perhaps be fallible instead of panicking?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: add `bit_util::copy_bits_within` and `{BooleanBufferBuilder, NullBufferBuilder}::copy_within` [arrow-rs]
Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton commented on PR #11196:
URL: https://github.com/apache/arrow-rs/pull/11196#issuecomment-5853484184
> Perhaps related to
>
> * [[EPIC] Use blocked / chunked memory management in hash aggregation datafusion#24704](https://github.com/apache/datafusion/issues/24704)
Yes, but it can be used in the existing code as well to reuse allocations
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: add `bit_util::copy_bits_within` and `{BooleanBufferBuilder, NullBufferBuilder}::copy_within` [arrow-rs]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #11196:
URL: https://github.com/apache/arrow-rs/pull/11196#issuecomment-5831399761
Perhaps related to
- https://github.com/apache/datafusion/issues/24704
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat: add `bit_util::copy_bits_within` and `{BooleanBufferBuilder, NullBufferBuilder}::copy_within` [arrow-rs]
Posted by "rluvaton (via GitHub)" <gi...@apache.org>.
rluvaton commented on code in PR #11196:
URL: https://github.com/apache/arrow-rs/pull/11196#discussion_r4114363522
##########
arrow-buffer/src/builder/boolean.rs:
##########
@@ -312,6 +312,27 @@ impl BooleanBufferBuilder {
self.append_packed_range(range, buffer.values())
}
+ /// Copies bits `src` of `data` to position `dest`
+ ///
+ /// # Arguments
+ /// * `src` - The source range of bits to copy
+ /// * `dest` - The destination bit index to copy to
+ ///
+ /// # Example
+ /// ```
+ /// # use arrow_buffer::BooleanBufferBuilder;
+ /// let mut builder = BooleanBufferBuilder::new(0);
+ /// builder.append_slice(&[true, false, false, false, false, true]);
+ /// // Copy values 4.. to position 1
+ /// builder.copy_within(4.., 1);
+ ///
+ /// let output = builder.build().iter().collect::<Vec<_>>();
+ /// assert_eq!(output, vec![true, false, true, false, false, true]);
+ /// ```
+ pub fn copy_within<R: RangeBounds<usize>>(&mut self, src: R, dest: usize) {
Review Comment:
I see that ArrowError is not available in this crate
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org