pub struct CsvToArrowReader<R> { /* private fields */ }Expand description
CSV-to-Arrow streaming reader.
This struct reads CSV data from an async reader and converts it to Arrow RecordBatches. It supports configurable batch sizes and handles NULL values and type parsing.
Implementations§
Source§impl<R: AsyncBufRead + Unpin> CsvToArrowReader<R>
impl<R: AsyncBufRead + Unpin> CsvToArrowReader<R>
Sourcepub fn new(reader: R, schema: Arc<Schema>, options: &ArrowExportOptions) -> Selfwhere
R: AsyncRead,
pub fn new(reader: R, schema: Arc<Schema>, options: &ArrowExportOptions) -> Selfwhere
R: AsyncRead,
Creates a new CsvToArrowReader.
§Arguments
reader- The async reader to read CSV data fromschema- The Arrow schema for the output RecordBatchesoptions- Export options including batch size and NULL value
Sourcepub fn from_buffered(
reader: BufReader<R>,
schema: Arc<Schema>,
options: &ArrowExportOptions,
) -> Selfwhere
R: AsyncRead,
pub fn from_buffered(
reader: BufReader<R>,
schema: Arc<Schema>,
options: &ArrowExportOptions,
) -> Selfwhere
R: AsyncRead,
Creates a new CsvToArrowReader from an already buffered reader.
§Arguments
reader- The buffered async reader to read CSV data fromschema- The Arrow schema for the output RecordBatchesoptions- Export options including batch size and NULL value
Sourcepub async fn next_batch(&mut self) -> Result<Option<RecordBatch>, ExportError>
pub async fn next_batch(&mut self) -> Result<Option<RecordBatch>, ExportError>
Reads the next batch of rows and returns a RecordBatch.
§Returns
Ok(Some(batch))- A RecordBatch with up tobatch_sizerowsOk(None)- No more data to readErr(e)- An error occurred during parsing or conversion
Auto Trait Implementations§
impl<R> Freeze for CsvToArrowReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for CsvToArrowReader<R>where
R: RefUnwindSafe,
impl<R> Send for CsvToArrowReader<R>where
R: Send,
impl<R> Sync for CsvToArrowReader<R>where
R: Sync,
impl<R> Unpin for CsvToArrowReader<R>where
R: Unpin,
impl<R> UnsafeUnpin for CsvToArrowReader<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for CsvToArrowReader<R>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more