Flushes the currently buffered data to a [`RecordBatch`] This should only be called after [`Self::decode`] has returned `Ok(0)`, otherwise may return an error if part way through decoding a record Returns `Ok(None)` if no buffered data
(&mut self)
| 655 | /// |
| 656 | /// Returns `Ok(None)` if no buffered data |
| 657 | pub fn flush(&mut self) -> Result<Option<RecordBatch>, ArrowError> { |
| 658 | if self.record_decoder.is_empty() { |
| 659 | return Ok(None); |
| 660 | } |
| 661 | |
| 662 | let rows = self.record_decoder.flush()?; |
| 663 | let batch = parse( |
| 664 | &rows, |
| 665 | self.schema.fields(), |
| 666 | Some(self.schema.metadata.clone()), |
| 667 | self.projection.as_ref(), |
| 668 | self.line_number, |
| 669 | &self.null_regex, |
| 670 | )?; |
| 671 | self.line_number += rows.len(); |
| 672 | Ok(Some(batch)) |
| 673 | } |
| 674 | |
| 675 | /// Returns the number of records that can be read before requiring a call to [`Self::flush`] |
| 676 | pub fn capacity(&self) -> usize { |