(&mut self)
| 94 | } |
| 95 | |
| 96 | fn consume_batch(&mut self) -> Result<ArrayRef> { |
| 97 | // A MapArray is just a ListArray with a StructArray child |
| 98 | // we can therefore just alter the ArrayData |
| 99 | let array = self.reader.consume_batch().unwrap(); |
| 100 | let data = array.to_data(); |
| 101 | let builder = data.into_builder().data_type(self.data_type.clone()); |
| 102 | |
| 103 | // SAFETY - we can assume that ListArrayReader produces valid ListArray |
| 104 | // of the expected type, and as such its output can be reinterpreted as |
| 105 | // a MapArray without validation |
| 106 | Ok(Arc::new(MapArray::from(unsafe { |
| 107 | builder.build_unchecked() |
| 108 | }))) |
| 109 | } |
| 110 | |
| 111 | fn skip_records(&mut self, num_records: usize) -> Result<usize> { |
| 112 | self.reader.skip_records(num_records) |
no test coverage detected