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

Method MinBufferSize

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

Returns the minimum buffer size needed to use the encoder for 'bit_width' This is the maximum length of a single run for 'bit_width'. It is not valid to pass a buffer less than this length.

Source from the content-addressed store, hash-verified

675 /// This is the maximum length of a single run for 'bit_width'.
676 /// It is not valid to pass a buffer less than this length.
677 static int64_t MinBufferSize(int bit_width) {
678 // 1 indicator byte and MAX_VALUES_PER_LITERAL_RUN 'bit_width' values.
679 int64_t max_literal_run_size =
680 1 + ::arrow::bit_util::BytesForBits(MAX_VALUES_PER_LITERAL_RUN * bit_width);
681 // Up to kMaxVlqByteLength indicator and a single 'bit_width' value.
682 int64_t max_repeated_run_size = bit_util::kMaxLEB128ByteLenFor<int32_t> +
683 ::arrow::bit_util::BytesForBits(bit_width);
684 return std::max(max_literal_run_size, max_repeated_run_size);
685 }
686
687 /// Returns the maximum byte size it could take to encode 'num_values'.
688 ///

Callers

nothing calls this directly

Calls 1

BytesForBitsFunction · 0.85

Tested by

no test coverage detected