| 476 | int dict_encoded_size() const override { return dict_encoded_size_; } |
| 477 | |
| 478 | int WriteIndices(uint8_t* buffer, int buffer_len) override { |
| 479 | // Write bit width in first byte |
| 480 | *buffer = static_cast<uint8_t>(bit_width()); |
| 481 | ++buffer; |
| 482 | --buffer_len; |
| 483 | |
| 484 | ::arrow::util::RleBitPackedEncoder encoder(buffer, buffer_len, bit_width()); |
| 485 | |
| 486 | for (int32_t index : buffered_indices_) { |
| 487 | if (ARROW_PREDICT_FALSE(!encoder.Put(index))) return -1; |
| 488 | } |
| 489 | encoder.Flush(); |
| 490 | |
| 491 | ClearIndices(); |
| 492 | return kDataPageBitWidthBytes + encoder.len(); |
| 493 | } |
| 494 | |
| 495 | /// Returns a conservative estimate of the number of bytes needed to encode the buffered |
| 496 | /// indices. Used to size the buffer passed to WriteIndices(). |
no test coverage detected