MCPcopy Create free account
hub / github.com/apache/arrow-rs / decode_fixed

Function decode_fixed

arrow-row/src/fixed.rs:436–460  ·  view source on GitHub ↗

Decodes a `ArrayData` from rows based on the provided `FixedLengthEncoding` `T` # Safety `data_type` must be appropriate native type for `T`

(
    rows: &mut [&[u8]],
    data_type: DataType,
    options: SortOptions,
)

Source from the content-addressed store, hash-verified

434///
435/// `data_type` must be appropriate native type for `T`
436unsafe fn decode_fixed<T: FixedLengthEncoding + ArrowNativeType>(
437 rows: &mut [&[u8]],
438 data_type: DataType,
439 options: SortOptions,
440) -> ArrayData {
441 let len = rows.len();
442
443 let mut values = BufferBuilder::<T>::new(len);
444 let (null_count, nulls) = decode_nulls(rows);
445
446 for row in rows {
447 let i = split_off(row, T::ENCODED_LEN);
448 let value = T::Encoded::from_slice(&i[1..], options.descending);
449 values.append(T::decode(value));
450 }
451
452 let builder = ArrayDataBuilder::new(data_type)
453 .len(len)
454 .null_count(null_count)
455 .add_buffer(values.finish())
456 .null_bit_buffer(Some(nulls));
457
458 // SAFETY: Buffers correct length
459 unsafe { builder.build_unchecked() }
460}
461
462/// Decodes a `PrimitiveArray` from rows
463pub fn decode_primitive<T: ArrowPrimitiveType>(

Callers

nothing calls this directly

Calls 11

decode_nullsFunction · 0.85
split_offFunction · 0.85
from_sliceFunction · 0.85
add_bufferMethod · 0.80
decodeFunction · 0.70
lenMethod · 0.45
appendMethod · 0.45
null_bit_bufferMethod · 0.45
null_countMethod · 0.45
finishMethod · 0.45
build_uncheckedMethod · 0.45

Tested by

no test coverage detected