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

Method Put

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

This function buffers input values 8 at a time. After seeing all 8 values, it decides whether they should be encoded as a literal or repeated run.

Source from the content-addressed store, hash-verified

1496/// This function buffers input values 8 at a time. After seeing all 8 values,
1497/// it decides whether they should be encoded as a literal or repeated run.
1498inline bool RleBitPackedEncoder::Put(uint64_t value) {
1499 ARROW_DCHECK(bit_width_ == 64 || value < (1ULL << bit_width_));
1500 if (ARROW_PREDICT_FALSE(buffer_full_)) return false;
1501
1502 if (ARROW_PREDICT_TRUE(current_value_ == value)) {
1503 ++repeat_count_;
1504 if (repeat_count_ > 8) {
1505 // This is just a continuation of the current run, no need to buffer the
1506 // values.
1507 // Note that this is the fast path for long repeated runs.
1508 return true;
1509 }
1510 } else {
1511 if (repeat_count_ >= 8) {
1512 // We had a run that was long enough but it has ended. Flush the
1513 // current repeated run.
1514 ARROW_DCHECK_EQ(literal_count_, 0);
1515 FlushRepeatedRun();
1516 }
1517 repeat_count_ = 1;
1518 current_value_ = value;
1519 }
1520
1521 buffered_values_[num_buffered_values_] = value;
1522 if (++num_buffered_values_ == 8) {
1523 ARROW_DCHECK_EQ(literal_count_ % 8, 0);
1524 FlushBufferedValues(false);
1525 }
1526 return true;
1527}
1528
1529inline void RleBitPackedEncoder::FlushLiteralRun(bool update_indicator_byte) {
1530 if (literal_indicator_byte_ == NULL) {

Callers 4

ValidateRleBitPackedFunction · 0.45
CheckRoundTripFunction · 0.45
TESTFunction · 0.45
EncodeTestArrayFunction · 0.45

Calls

no outgoing calls

Tested by 4

ValidateRleBitPackedFunction · 0.36
CheckRoundTripFunction · 0.36
TESTFunction · 0.36
EncodeTestArrayFunction · 0.36