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],
child_array: ArrayRef,
)
| 309 | /// Reads the correct number of buffers based on list type and null_count, and creates a |
| 310 | /// list array ref |
| 311 | fn create_list_array( |
| 312 | &self, |
| 313 | field_node: &FieldNode, |
| 314 | data_type: &DataType, |
| 315 | buffers: &[Buffer], |
| 316 | child_array: ArrayRef, |
| 317 | ) -> Result<ArrayRef, ArrowError> { |
| 318 | let null_buffer = (field_node.null_count() > 0).then_some(buffers[0].clone()); |
| 319 | let length = field_node.length() as usize; |
| 320 | let child_data = child_array.into_data(); |
| 321 | let mut builder = match data_type { |
| 322 | List(_) | LargeList(_) | Map(_, _) => ArrayData::builder(data_type.clone()) |
| 323 | .len(length) |
| 324 | .add_buffer(buffers[1].clone()) |
| 325 | .add_child_data(child_data) |
| 326 | .null_bit_buffer(null_buffer), |
| 327 | |
| 328 | FixedSizeList(_, _) => ArrayData::builder(data_type.clone()) |
| 329 | .len(length) |
| 330 | .add_child_data(child_data) |
| 331 | .null_bit_buffer(null_buffer), |
| 332 | |
| 333 | _ => unreachable!("Cannot create list or map array from {:?}", data_type), |
| 334 | }; |
| 335 | |
| 336 | builder = builder.null_count(field_node.null_count() as usize); |
| 337 | |
| 338 | self.create_array_from_builder(builder) |
| 339 | } |
| 340 | |
| 341 | fn create_list_view_array( |
| 342 | &self, |
no test coverage detected