hongzhi-gao commented on code in PR #764:
URL: https://github.com/apache/tsfile/pull/764#discussion_r3025624509
##########
cpp/src/encoding/int32_rle_decoder.h:
##########
@@ -109,24 +115,57 @@ class Int32RleDecoder : public Decoder {
read_length_and_bitwidth(buffer);
}
if (current_count_ == 0) {
- uint8_t header;
+ // The header is encoded as an unsigned varint where:
+ // low bit = 0 => RLE run: header_value >> 1 is the run
+ // count low bit = 1 => bit-packing: header_value >> 1 is the
+ // group count
+ uint32_t header_value = 0;
int ret = common::E_OK;
- if (RET_FAIL(
- common::SerializationUtil::read_ui8(header, byte_cache_)))
{
+ if (RET_FAIL(common::SerializationUtil::read_var_uint(
+ header_value, byte_cache_))) {
return ret;
}
- call_read_bit_packing_buffer(header);
+ if (header_value & 1) {
+ call_read_bit_packing_buffer(header_value);
+ } else {
+ call_read_rle_run(header_value);
Review Comment:
Please check these return values and propagate failures.
--
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]