MCPcopy Create free account
hub / github.com/apache/arrow / FlushBufferedValues

Method FlushBufferedValues

cpp/src/arrow/util/rle_encoding_internal.h:1575–1603  ·  view source on GitHub ↗

Flush the values that have been buffered. At this point we decide whether we need to switch between the run types or continue the current one.

Source from the content-addressed store, hash-verified

1573/// Flush the values that have been buffered. At this point we decide whether
1574/// we need to switch between the run types or continue the current one.
1575inline void RleBitPackedEncoder::FlushBufferedValues(bool done) {
1576 if (repeat_count_ >= 8) {
1577 // Clear the buffered values. They are part of the repeated run now and we
1578 // don't want to flush them out as literals.
1579 num_buffered_values_ = 0;
1580 if (literal_count_ != 0) {
1581 // There was a current literal run. All the values in it have been flushed
1582 // but we still need to update the indicator byte.
1583 ARROW_DCHECK_EQ(literal_count_ % 8, 0);
1584 ARROW_DCHECK_EQ(repeat_count_, 8);
1585 FlushLiteralRun(true);
1586 }
1587 ARROW_DCHECK_EQ(literal_count_, 0);
1588 return;
1589 }
1590
1591 literal_count_ += num_buffered_values_;
1592 ARROW_DCHECK_EQ(literal_count_ % 8, 0);
1593 int num_groups = literal_count_ / 8;
1594 if (num_groups + 1 >= (1 << 6)) {
1595 // We need to start a new literal run because the indicator byte we've reserved
1596 // cannot store more values.
1597 ARROW_DCHECK(literal_indicator_byte_ != NULL);
1598 FlushLiteralRun(true);
1599 } else {
1600 FlushLiteralRun(done);
1601 }
1602 repeat_count_ = 0;
1603}
1604
1605inline int RleBitPackedEncoder::Flush() {
1606 if (literal_count_ > 0 || repeat_count_ > 0 || num_buffered_values_ > 0) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected