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

Method flush

arrow-csv/src/reader/mod.rs:657–673  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 {

Callers 5

writeMethod · 0.45
readMethod · 0.45

Calls 6

parseFunction · 0.70
is_emptyMethod · 0.45
fieldsMethod · 0.45
cloneMethod · 0.45
as_refMethod · 0.45
lenMethod · 0.45