RkGrit commented on code in PR #110:
URL: https://github.com/apache/tsfile/pull/110#discussion_r1650279307
##########
cpp/src/encoding/bitpack_encoder.h:
##########
@@ -167,6 +165,24 @@ class BitPackEncoder {
bytes_buffer_.clear();
bitpacked_group_count_ = 0;
}
+
+ int get_max_byte_size() {
+ if (values_.empty()) {
+ return 0;
+ }
+ int maxBitWidth = get_int_max_bit_width(values_);
+ int totalValues = values_.size();
+ int fullGroups = totalValues / 8;
+ int remainingValues = totalValues % 8;
+ int bytesPerGroup = (maxBitWidth * 8 + 7) / 8;
+ int maxSize = 0;
+ maxSize += fullGroups * bytesPerGroup;
+ if (remainingValues > 0) {
+ maxSize += bytesPerGroup;
+ }
+ maxSize += fullGroups * (1 + 1) + (remainingValues > 0 ? (1 + 1) : 0);
Review Comment:
"1+1" means each bitpack group has a header of 1 byte and a tail of 1 byte
--
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]