-
Notifications
You must be signed in to change notification settings - Fork 784
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
Fix BitReader::get_batch zero extension (#1708) #1722
Fix BitReader::get_batch zero extension (#1708) #1722
Conversation
Unfortunately this does represent a performance regression, but better slow and correct, than fast and incorrect. I'll have a think about how we might reduce this
|
We also have test failures 👀 |
Codecov Report
@@ Coverage Diff @@
## master #1722 +/- ##
==========================================
- Coverage 83.32% 83.31% -0.01%
==========================================
Files 195 195
Lines 56044 55986 -58
==========================================
- Hits 46698 46646 -52
+ Misses 9346 9340 -6
Continue to review full report at Codecov.
|
I tested this branch on the repro from #1708 and it produces the correct results 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for the fix!
Which issue does this PR close?
Closes #1708.
Rationale for this change
unpack32
as used byBitReader::get_batch
always decodes to an array of 32, 32-bit integers. If the type being read is a different size it will read to a temporary buffer and then either truncate or zero-extend the data.An oversight meant that instead of zero-extending, it would just set up to the first 4 bytes, and leave any remaining bytes alone.
In practice this didn't matter as we were only using this for decoding 16-bit levels, however, with #1284 the DeltaBitPackDecoder was changed to also use this method. As this does get used with 64-bit types, buffer reuse could easily lead to garbage data on decode.
What changes are included in this PR?
Fixes
BitReader::get_batch
to correctly zero-extend, and reduces the use of unsafe in the process.Are there any user-facing changes?
No