Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions arrow-buffer/src/builder/null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ impl NullBufferBuilder {
self.bitmap_builder.as_mut().map(|b| b.as_slice_mut())
}

/// Return the allocated size of this builder, in bits, useful for memory accounting.
/// Return the allocated size of this builder, in bytes, useful for memory accounting.
pub fn allocated_size(&self) -> usize {
self.bitmap_builder
.as_ref()
.map(|b| b.capacity())
.map(|b| b.capacity() / 8)
.unwrap_or(0)
}
}
Expand Down Expand Up @@ -250,7 +250,7 @@ mod tests {
builder.append_n_nulls(2);
builder.append_n_non_nulls(2);
assert_eq!(6, builder.len());
assert_eq!(512, builder.allocated_size());
assert_eq!(64, builder.allocated_size());

let buf = builder.finish().unwrap();
assert_eq!(&[0b110010_u8], buf.validity());
Expand All @@ -263,7 +263,7 @@ mod tests {
builder.append_n_nulls(2);
builder.append_slice(&[false, false, false]);
assert_eq!(6, builder.len());
assert_eq!(512, builder.allocated_size());
assert_eq!(64, builder.allocated_size());

let buf = builder.finish().unwrap();
assert_eq!(&[0b0_u8], buf.validity());
Expand Down Expand Up @@ -327,7 +327,7 @@ mod tests {
builder.append_null();
builder.append_non_null();
assert_eq!(builder.as_slice().unwrap(), &[0xFF, 0b10111111]);
assert_eq!(builder.allocated_size(), 512);
assert_eq!(builder.allocated_size(), 64);
}

#[test]
Expand Down
Loading