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

Method Put

cpp/src/arrow/util/rle_encoding_internal.h:1367–1396  ·  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

1365/// This function buffers input values 8 at a time. After seeing all 8 values,
1366/// it decides whether they should be encoded as a literal or repeated run.
1367inline bool RleBitPackedEncoder::Put(uint64_t value) {
1368 ARROW_DCHECK(bit_width_ == 64 || value < (1ULL << bit_width_));
1369 if (ARROW_PREDICT_FALSE(buffer_full_)) return false;
1370
1371 if (ARROW_PREDICT_TRUE(current_value_ == value)) {
1372 ++repeat_count_;
1373 if (repeat_count_ > 8) {
1374 // This is just a continuation of the current run, no need to buffer the
1375 // values.
1376 // Note that this is the fast path for long repeated runs.
1377 return true;
1378 }
1379 } else {
1380 if (repeat_count_ >= 8) {
1381 // We had a run that was long enough but it has ended. Flush the
1382 // current repeated run.
1383 ARROW_DCHECK_EQ(literal_count_, 0);
1384 FlushRepeatedRun();
1385 }
1386 repeat_count_ = 1;
1387 current_value_ = value;
1388 }
1389
1390 buffered_values_[num_buffered_values_] = value;
1391 if (++num_buffered_values_ == 8) {
1392 ARROW_DCHECK_EQ(literal_count_ % 8, 0);
1393 FlushBufferedValues(false);
1394 }
1395 return true;
1396}
1397
1398inline void RleBitPackedEncoder::FlushLiteralRun(bool update_indicator_byte) {
1399 if (literal_indicator_byte_ == NULL) {

Callers 3

ValidateRleBitPackedFunction · 0.45
CheckRoundTripFunction · 0.45
TESTFunction · 0.45

Calls

no outgoing calls

Tested by 3

ValidateRleBitPackedFunction · 0.36
CheckRoundTripFunction · 0.36
TESTFunction · 0.36