| 150 | } |
| 151 | |
| 152 | void LevelDecoder::SetDataV2(int32_t num_bytes, int16_t max_level, |
| 153 | int num_buffered_values, const uint8_t* data) { |
| 154 | max_level_ = max_level; |
| 155 | // Repetition and definition levels always uses RLE encoding |
| 156 | // in the DataPageV2 format. |
| 157 | if (num_bytes < 0) { |
| 158 | throw ParquetException("Invalid page header (corrupt data page?)"); |
| 159 | } |
| 160 | encoding_ = Encoding::RLE; |
| 161 | num_values_remaining_ = num_buffered_values; |
| 162 | bit_width_ = bit_util::Log2(max_level + 1); |
| 163 | |
| 164 | if (!rle_decoder_) { |
| 165 | rle_decoder_ = std::make_unique<::arrow::util::RleBitPackedDecoder<int16_t>>( |
| 166 | data, num_bytes, bit_width_); |
| 167 | } else { |
| 168 | rle_decoder_->Reset(data, num_bytes, bit_width_); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | int LevelDecoder::Decode(int batch_size, int16_t* levels) { |
| 173 | int num_decoded = 0; |
no test coverage detected