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

Method Put

be/src/util/rle-encoding.h:342–373  ·  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

340/// This function buffers input values 8 at a time. After seeing all 8 values,
341/// it decides whether they should be encoded as a literal or repeated run.
342inline bool RleEncoder::Put(uint64_t value) {
343 DCHECK(bit_width_ == 64 || value < (1LL << bit_width_));
344 if (UNLIKELY(buffer_full_)) return false;
345
346 if (LIKELY(current_value_ == value
347 && repeat_count_ < std::numeric_limits<int32_t>::max())) {
348 ++repeat_count_;
349 if (repeat_count_ > 8) {
350 // This is just a continuation of the current run, no need to buffer the
351 // values.
352 // Note that this is the fast path for long repeated runs.
353 return true;
354 }
355 } else {
356 if (repeat_count_ >= 8) {
357 // We had a run that was long enough but it ended, either because of a different
358 // value or because it exceeded the maximum run length. Flush the current repeated
359 // run.
360 DCHECK_EQ(literal_count_, 0);
361 FlushRepeatedRun();
362 }
363 repeat_count_ = 1;
364 current_value_ = value;
365 }
366
367 buffered_values_[num_buffered_values_] = value;
368 if (++num_buffered_values_ == 8) {
369 DCHECK_EQ(literal_count_ % 8, 0);
370 FlushBufferedValues(false);
371 }
372 return true;
373}
374
375inline void RleEncoder::FlushLiteralRun(bool update_indicator_byte) {
376 if (literal_indicator_byte_ == NULL) {

Callers 8

DeltaEncodeAllFunction · 0.45
DictEncodeAllFunction · 0.45
FillWithRleFunction · 0.45
ValidateRleMethod · 0.45
ValidateRleSkipMethod · 0.45
TEST_FFunction · 0.45
ValidateDictFunction · 0.45
TESTFunction · 0.45

Calls 1

maxFunction · 0.85

Tested by 5

ValidateRleMethod · 0.36
ValidateRleSkipMethod · 0.36
TEST_FFunction · 0.36
ValidateDictFunction · 0.36
TESTFunction · 0.36