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

Method Put

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

1343/// This function buffers input values 8 at a time. After seeing all 8 values,
1344/// it decides whether they should be encoded as a literal or repeated run.
1345inline bool RleBitPackedEncoder::Put(uint64_t value) {
1346 ARROW_DCHECK(bit_width_ == 64 || value < (1ULL << bit_width_));
1347 if (ARROW_PREDICT_FALSE(buffer_full_)) return false;
1348
1349 if (ARROW_PREDICT_TRUE(current_value_ == value)) {
1350 ++repeat_count_;
1351 if (repeat_count_ > 8) {
1352 // This is just a continuation of the current run, no need to buffer the
1353 // values.
1354 // Note that this is the fast path for long repeated runs.
1355 return true;
1356 }
1357 } else {
1358 if (repeat_count_ >= 8) {
1359 // We had a run that was long enough but it has ended. Flush the
1360 // current repeated run.
1361 ARROW_DCHECK_EQ(literal_count_, 0);
1362 FlushRepeatedRun();
1363 }
1364 repeat_count_ = 1;
1365 current_value_ = value;
1366 }
1367
1368 buffered_values_[num_buffered_values_] = value;
1369 if (++num_buffered_values_ == 8) {
1370 ARROW_DCHECK_EQ(literal_count_ % 8, 0);
1371 FlushBufferedValues(false);
1372 }
1373 return true;
1374}
1375
1376inline void RleBitPackedEncoder::FlushLiteralRun(bool update_indicator_byte) {
1377 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