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

Method into_array

parquet/src/arrow/buffer/view_buffer.rs:55–70  ·  view source on GitHub ↗

Converts this into an [`ArrayRef`] with the provided `data_type` and `null_buffer`

(self, null_buffer: Option<Buffer>, data_type: &ArrowType)

Source from the content-addressed store, hash-verified

53
54 /// Converts this into an [`ArrayRef`] with the provided `data_type` and `null_buffer`
55 pub fn into_array(self, null_buffer: Option<Buffer>, data_type: &ArrowType) -> ArrayRef {
56 let len = self.views.len();
57 let views = ScalarBuffer::from(self.views);
58 let nulls = null_buffer.and_then(|b| NullBuffer::from_unsliced_buffer(b, len));
59 match data_type {
60 ArrowType::Utf8View => {
61 // Safety: views were created correctly, and checked that the data is utf8 when building the buffer
62 unsafe { Arc::new(StringViewArray::new_unchecked(views, self.buffers, nulls)) }
63 }
64 ArrowType::BinaryView => {
65 // Safety: views were created correctly
66 unsafe { Arc::new(BinaryViewArray::new_unchecked(views, self.buffers, nulls)) }
67 }
68 _ => panic!("Unsupported data type: {data_type}"),
69 }
70 }
71}
72
73impl ValuesBuffer for ViewBuffer {

Callers 15

consume_batchMethod · 0.45
consume_batchMethod · 0.45
set_dictMethod · 0.45
test_dictionary_fallbackFunction · 0.45
test_nullsFunction · 0.45
consume_batchMethod · 0.45
test_byte_array_decoderFunction · 0.45

Calls 2

and_thenMethod · 0.80
lenMethod · 0.45