tustvold commented on code in PR #2221:
URL: https://github.com/apache/arrow-rs/pull/2221#discussion_r933066870
##########
parquet/src/encodings/encoding/dict_encoder.rs:
##########
@@ -148,12 +148,7 @@ impl<T: DataType> DictEncoder<T> {
#[inline]
fn bit_width(&self) -> u8 {
- let num_entries = self.num_entries();
- if num_entries <= 1 {
- num_entries as u8
- } else {
- num_required_bits(num_entries as u64 - 1)
- }
+ num_required_bits(self.num_entries().saturating_sub(1) as u64)
Review Comment:
This logic was actually previously incorrect as it would return a bit_width
of 1 for `num_entries == 1` when it only needed to be 0. This is largely
harmless, but is worth fixing.
--
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]