MCPcopy Create free account
hub / github.com/apache/datafusion / estimate_byte_data_size

Function estimate_byte_data_size

datafusion/functions/src/encoding/inner.rs:278–285  ·  view source on GitHub ↗

Estimate how many bytes are actually represented by the array; in case the the array slices it's internal buffer, this returns the byte size of that slice but not the byte size of the entire buffer. This is an estimation only as it can estimate higher if null slots are non-zero sized.

(array: &GenericBinaryArray<O>)

Source from the content-addressed store, hash-verified

276/// This is an estimation only as it can estimate higher if null slots are non-zero
277/// sized.
278fn estimate_byte_data_size<O: OffsetSizeTrait>(array: &GenericBinaryArray<O>) -> usize {
279 let offsets = array.value_offsets();
280 // Unwraps are safe as should always have 1 element in offset buffer
281 let start = *offsets.first().unwrap();
282 let end = *offsets.last().unwrap();
283 let data_size = end - start;
284 data_size.as_usize()
285}
286
287fn decode_array(array: &ArrayRef, encoding: Encoding) -> Result<ColumnarValue> {
288 let array = match array.data_type() {

Callers 2

decode_arrayFunction · 0.85

Calls 4

value_offsetsMethod · 0.80
lastMethod · 0.80
firstMethod · 0.45
as_usizeMethod · 0.45

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…