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

Update Bitmap::len to return bits rather than bytes #749

Merged
merged 1 commit into from
Sep 9, 2021
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
8 changes: 4 additions & 4 deletions arrow/src/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Bitmap {
}

pub fn len(&self) -> usize {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add a docstring here that explains what Bitmap::len actually returns (aka the length in bits, not bytes)?

self.bits.len()
self.bits.len() * 8
}

pub fn is_empty(&self) -> bool {
Expand Down Expand Up @@ -117,9 +117,9 @@ mod tests {

#[test]
fn test_bitmap_length() {
assert_eq!(64, Bitmap::new(63 * 8).len());
assert_eq!(64, Bitmap::new(64 * 8).len());
assert_eq!(128, Bitmap::new(65 * 8).len());
assert_eq!(512, Bitmap::new(63 * 8).len());
assert_eq!(512, Bitmap::new(64 * 8).len());
assert_eq!(1024, Bitmap::new(65 * 8).len());
}

#[test]
Expand Down