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

Method FlushLiteralRun

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

Source from the content-addressed store, hash-verified

1374}
1375
1376inline void RleBitPackedEncoder::FlushLiteralRun(bool update_indicator_byte) {
1377 if (literal_indicator_byte_ == NULL) {
1378 // The literal indicator byte has not been reserved yet, get one now.
1379 literal_indicator_byte_ = bit_writer_.GetNextBytePtr();
1380 ARROW_DCHECK(literal_indicator_byte_ != NULL);
1381 }
1382
1383 // Write all the buffered values as bit packed literals
1384 for (int i = 0; i < num_buffered_values_; ++i) {
1385 bool success = bit_writer_.PutValue(buffered_values_[i], bit_width_);
1386 ARROW_DCHECK(success) << "There is a bug in using CheckBufferFull()";
1387 }
1388 num_buffered_values_ = 0;
1389
1390 if (update_indicator_byte) {
1391 // At this point we need to write the indicator byte for the literal run.
1392 // We only reserve one byte, to allow for streaming writes of literal values.
1393 // The logic makes sure we flush literal runs often enough to not overrun
1394 // the 1 byte.
1395 ARROW_DCHECK_EQ(literal_count_ % 8, 0);
1396 int num_groups = literal_count_ / 8;
1397 int32_t indicator_value = (num_groups << 1) | 1;
1398 ARROW_DCHECK_EQ(indicator_value & 0xFFFFFF00, 0);
1399 *literal_indicator_byte_ = static_cast<uint8_t>(indicator_value);
1400 literal_indicator_byte_ = NULL;
1401 literal_count_ = 0;
1402 CheckBufferFull();
1403 }
1404}
1405
1406inline void RleBitPackedEncoder::FlushRepeatedRun() {
1407 ARROW_DCHECK_GT(repeat_count_, 0);

Callers

nothing calls this directly

Calls 2

GetNextBytePtrMethod · 0.80
PutValueMethod · 0.80

Tested by

no test coverage detected