Dandandan commented on code in PR #9137:
URL: https://github.com/apache/arrow-rs/pull/9137#discussion_r2679403039
##########
arrow-buffer/src/builder/boolean.rs:
##########
@@ -259,6 +259,135 @@ impl BooleanBufferBuilder {
pub fn finish_cloned(&self) -> BooleanBuffer {
BooleanBuffer::new(Buffer::from_slice_ref(self.as_slice()), 0,
self.len)
}
+
+ /// Advances the buffer by `additional` bits without initializing the new
bytes.
+ ///
+ /// # Safety
+ /// Callers must ensure that all newly added bits are written before the
buffer is read.
+ #[inline]
+ unsafe fn advance_uninit(&mut self, additional: usize) {
+ let new_len = self.len + additional;
+ let new_len_bytes = bit_util::ceil(new_len, 8);
+ if new_len_bytes > self.buffer.len() {
+ self.buffer.reserve(new_len_bytes - self.buffer.len());
+ // SAFETY: caller will initialize all newly exposed bytes
+ unsafe { self.buffer.set_len(new_len_bytes) };
+ }
+ self.len = new_len;
+ }
+
+ /// Extends this builder with boolean values.
+ ///
+ /// This requires `iter` to report an exact size via `size_hint`.
+ ///
+ /// # Safety
+ /// Callers must ensure that `iter` reports an exact size via `size_hint`.
+ #[inline]
+ pub unsafe fn extend_trusted_len<I: Iterator<Item = bool>>(&mut self,
iter: I) {
Review Comment:
Done
##########
arrow-buffer/src/builder/boolean.rs:
##########
@@ -259,6 +259,135 @@ impl BooleanBufferBuilder {
pub fn finish_cloned(&self) -> BooleanBuffer {
BooleanBuffer::new(Buffer::from_slice_ref(self.as_slice()), 0,
self.len)
}
+
+ /// Advances the buffer by `additional` bits without initializing the new
bytes.
Review Comment:
Done
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]