tustvold commented on code in PR #1905:
URL: https://github.com/apache/arrow-rs/pull/1905#discussion_r901062526
##########
parquet/src/encodings/encoding.rs:
##########
@@ -307,12 +307,10 @@ impl<T: DataType> DictEncoder<T> {
#[inline]
fn bit_width(&self) -> u8 {
let num_entries = self.uniques.len();
- if num_entries == 0 {
- 0
- } else if num_entries == 1 {
- 1
+ if num_entries <= 1 {
+ num_entries as u8
} else {
- log2(num_entries as u64) as u8
+ num_required_bits(num_entries as u64 - 1)
Review Comment:
Is this actually correct? Or was this a pre-existing bug. Why is the bit
width here 1 less?
Edit: oh because the max value is one less than the array length
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]