Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Improved debug repr of buffers and bitmaps. #284

Merged
merged 1 commit into from
Aug 13, 2021
Merged

Conversation

jorgecarleitao
Copy link
Owner

@jorgecarleitao jorgecarleitao commented Aug 13, 2021

This makes the representation of buffers and bitmaps more useful.

Examples:

let buffer = MutableBuffer::<i32>::from(&[0, 1, 2, 3]);
assert_eq!(format!("{:?}", buffer), "[0, 1, 2, 3]")
let b = Bitmap::from([true, true, false, true, true, true, true, true, true]);
assert_eq!(format!("{:?}", b), "[0b11111011, 0b_______1]");
let b = b.slice(2, 7);

assert_eq!(format!("{:?}", b), "[0b111110__, 0b_______1]");

The bitmap representation ensures that the bitmap is shown as it is represented in bits, but pads with _ any bits that are not visible either due to its offset or length.

We lose the pointer, capacity, offset and the full data in sliced, which imo for most use-cases is not really needed. OTOH, it makes it much easier to read.

@jorgecarleitao jorgecarleitao added the feature A new feature label Aug 13, 2021
@codecov
Copy link

codecov bot commented Aug 13, 2021

Codecov Report

Merging #284 (5768e09) into main (d1a5025) will increase coverage by 0.21%.
The diff coverage is 98.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #284      +/-   ##
==========================================
+ Coverage   77.24%   77.46%   +0.21%     
==========================================
  Files         254      255       +1     
  Lines       20733    20916     +183     
==========================================
+ Hits        16016    16203     +187     
+ Misses       4717     4713       -4     
Impacted Files Coverage Δ
src/bitmap/utils/mod.rs 100.00% <ø> (ø)
src/bitmap/utils/fmt.rs 96.87% <96.87%> (ø)
src/bitmap/immutable.rs 88.23% <100.00%> (+0.89%) ⬆️
src/bitmap/mutable.rs 92.63% <100.00%> (+0.46%) ⬆️
src/buffer/immutable.rs 97.50% <100.00%> (+0.23%) ⬆️
src/buffer/mutable.rs 91.94% <100.00%> (+0.18%) ⬆️
src/compute/nullif.rs 0.00% <0.00%> (-1.82%) ⬇️
src/io/csv/write/mod.rs 88.88% <0.00%> (+1.38%) ⬆️
src/io/json_integration/schema.rs 54.62% <0.00%> (+12.50%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1a5025...5768e09. Read the comment docs.

@jorgecarleitao jorgecarleitao added enhancement An improvement to an existing feature and removed feature A new feature labels Aug 13, 2021
@jorgecarleitao jorgecarleitao merged commit f3667b8 into main Aug 13, 2021
@jorgecarleitao jorgecarleitao deleted the debug_buffer branch August 13, 2021 20:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement An improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant