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

Method into_array

parquet/src/arrow/buffer/offset_buffer.rs:133–146  ·  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

131
132 /// Converts this into an [`ArrayRef`] with the provided `data_type` and `null_buffer`
133 pub fn into_array(self, null_buffer: Option<Buffer>, data_type: ArrowType) -> ArrayRef {
134 let array_data_builder = ArrayDataBuilder::new(data_type)
135 .len(self.len())
136 .add_buffer(Buffer::from_vec(self.offsets))
137 .add_buffer(Buffer::from_vec(self.values))
138 .null_bit_buffer(null_buffer);
139
140 let data = match cfg!(debug_assertions) {
141 true => array_data_builder.build().unwrap(),
142 false => unsafe { array_data_builder.build_unchecked() },
143 };
144
145 make_array(data)
146 }
147}
148
149impl<I: OffsetSizeTrait> ValuesBuffer for OffsetBuffer<I> {

Callers 5

test_offset_buffer_emptyFunction · 0.45
test_offset_bufferFunction · 0.45
test_pad_nulls_emptyFunction · 0.45

Calls 6

add_bufferMethod · 0.80
make_arrayFunction · 0.50
null_bit_bufferMethod · 0.45
lenMethod · 0.45
buildMethod · 0.45
build_uncheckedMethod · 0.45

Tested by 5

test_offset_buffer_emptyFunction · 0.36
test_offset_bufferFunction · 0.36
test_pad_nulls_emptyFunction · 0.36