| 1527 | } |
| 1528 | |
| 1529 | inline void RleBitPackedEncoder::FlushLiteralRun(bool update_indicator_byte) { |
| 1530 | if (literal_indicator_byte_ == NULL) { |
| 1531 | // The literal indicator byte has not been reserved yet, get one now. |
| 1532 | literal_indicator_byte_ = bit_writer_.GetNextBytePtr(); |
| 1533 | ARROW_DCHECK(literal_indicator_byte_ != NULL); |
| 1534 | } |
| 1535 | |
| 1536 | // Write all the buffered values as bit packed literals |
| 1537 | for (int i = 0; i < num_buffered_values_; ++i) { |
| 1538 | bool success = bit_writer_.PutValue(buffered_values_[i], bit_width_); |
| 1539 | ARROW_DCHECK(success) << "There is a bug in using CheckBufferFull()"; |
| 1540 | } |
| 1541 | num_buffered_values_ = 0; |
| 1542 | |
| 1543 | if (update_indicator_byte) { |
| 1544 | // At this point we need to write the indicator byte for the literal run. |
| 1545 | // We only reserve one byte, to allow for streaming writes of literal values. |
| 1546 | // The logic makes sure we flush literal runs often enough to not overrun |
| 1547 | // the 1 byte. |
| 1548 | ARROW_DCHECK_EQ(literal_count_ % 8, 0); |
| 1549 | int num_groups = literal_count_ / 8; |
| 1550 | int32_t indicator_value = (num_groups << 1) | 1; |
| 1551 | ARROW_DCHECK_EQ(indicator_value & 0xFFFFFF00, 0); |
| 1552 | *literal_indicator_byte_ = static_cast<uint8_t>(indicator_value); |
| 1553 | literal_indicator_byte_ = NULL; |
| 1554 | literal_count_ = 0; |
| 1555 | CheckBufferFull(); |
| 1556 | } |
| 1557 | } |
| 1558 | |
| 1559 | inline void RleBitPackedEncoder::FlushRepeatedRun() { |
| 1560 | ARROW_DCHECK_GT(repeat_count_, 0); |
nothing calls this directly
no test coverage detected