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

Method create_dictionary_array

arrow-ipc/src/reader.rs:417–436  ·  view source on GitHub ↗

Reads the correct number of buffers based on list type and null_count, and creates a list array ref

(
        &self,
        field_node: &FieldNode,
        data_type: &DataType,
        buffers: &[Buffer],
        value_array: ArrayRef,
    )

Source from the content-addressed store, hash-verified

415 /// Reads the correct number of buffers based on list type and null_count, and creates a
416 /// list array ref
417 fn create_dictionary_array(
418 &self,
419 field_node: &FieldNode,
420 data_type: &DataType,
421 buffers: &[Buffer],
422 value_array: ArrayRef,
423 ) -> Result<ArrayRef, ArrowError> {
424 if let Dictionary(_, _) = *data_type {
425 let null_buffer = (field_node.null_count() > 0).then_some(buffers[0].clone());
426 let builder = ArrayData::builder(data_type.clone())
427 .len(field_node.length() as usize)
428 .add_buffer(buffers[1].clone())
429 .add_child_data(value_array.into_data())
430 .null_bit_buffer(null_buffer)
431 .null_count(field_node.null_count() as usize);
432 self.create_array_from_builder(builder)
433 } else {
434 unreachable!("Cannot create dictionary array from {:?}", data_type)
435 }
436 }
437}
438
439/// State for decoding Arrow arrays from an [IPC RecordBatch] structure to

Callers 1

create_arrayMethod · 0.80

Calls 9

add_child_dataMethod · 0.80
add_bufferMethod · 0.80
null_countMethod · 0.45
cloneMethod · 0.45
null_bit_bufferMethod · 0.45
lenMethod · 0.45
lengthMethod · 0.45
into_dataMethod · 0.45

Tested by

no test coverage detected