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

Boolean bitpacking #1884

Merged
merged 1 commit into from
Aug 9, 2023
Merged

Boolean bitpacking #1884

merged 1 commit into from
Aug 9, 2023

Conversation

benjaminwinger
Copy link
Collaborator

Implements boolean bitpacking for on-disk booleans and unpacks them when reading into ValueVectors.
Requires #1862.

I also optimized ColumnChunk::templateCopyArrowArray<bool> to use copyNullMask instead of setting the bits individually. Arrow's null bits are flipped in comparison to kuzu's, so I modified the copy function to allow the result to be inverted.

@codecov
Copy link

codecov bot commented Aug 2, 2023

Codecov Report

Patch coverage: 82.53% and project coverage change: -0.02% ⚠️

Comparison is base (765d6f3) 89.73% compared to head (694395a) 89.71%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1884      +/-   ##
==========================================
- Coverage   89.73%   89.71%   -0.02%     
==========================================
  Files         869      869              
  Lines       31126    31131       +5     
==========================================
  Hits        27930    27930              
- Misses       3196     3201       +5     
Files Changed Coverage Δ
src/common/types/types.cpp 92.87% <ø> (-0.06%) ⬇️
src/include/common/null_mask.h 100.00% <ø> (ø)
src/include/common/types/types.h 100.00% <ø> (ø)
src/include/storage/store/node_column.h 100.00% <ø> (ø)
src/storage/storage_utils.cpp 86.15% <ø> (-0.52%) ⬇️
src/storage/store/node_column.cpp 80.06% <72.72%> (+1.65%) ⬆️
src/storage/copier/column_chunk.cpp 78.36% <83.33%> (-1.97%) ⬇️
src/common/null_mask.cpp 94.20% <100.00%> (ø)
src/include/storage/copier/column_chunk.h 96.42% <100.00%> (+0.27%) ⬆️
src/include/storage/storage_utils.h 100.00% <100.00%> (ø)

... and 14 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@benjaminwinger benjaminwinger force-pushed the bool-bitpacking-storage branch 3 times, most recently from b933b5e to d1d5317 Compare August 9, 2023 14:19
Copy link
Contributor

@ray6080 ray6080 left a comment

Choose a reason for hiding this comment

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

LGTM!

src/storage/store/node_column.cpp Show resolved Hide resolved
src/storage/store/node_column.cpp Outdated Show resolved Hide resolved
@@ -52,7 +52,20 @@ struct PageElementCursor {
};

struct PageUtils {
static uint32_t getNumElementsInAPage(uint32_t elementSize, bool hasNull);
static constexpr uint32_t getNumElementsInAPage(uint32_t elementSize, bool hasNull) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why move from cpp to header file? If you want to keep it inside the header file, mark this function as inline.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'd moved it because so it can be constexpr, and constexpr (according to cppreference) implies inline (for cases where it's evaluated at runtime presumably).

Frankly, the static_assert I'd used it for is probably not necessary, but I thought it at least made more sense to make it a single static assert than multiple runtime asserts.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. Yeah, this makes sense.

@benjaminwinger benjaminwinger merged commit 1f1da48 into master Aug 9, 2023
10 checks passed
@benjaminwinger benjaminwinger deleted the bool-bitpacking-storage branch August 9, 2023 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants