pub struct ParallelTextWriter {
writer: Option<BufWriter<File>>,
schema: SchemaRef,
format: OutFormat,
wrote_batch: bool,
rows_written: usize,
staging_path: Option<PathBuf>,
destination: PathBuf,
overwrite: bool,
}Expand description
CSV/NDJSON writer that encodes independent batches concurrently and commits their bytes in input order.
Each call to write is one bounded parallel work group. The
caller controls memory by limiting the number and size of batches in that
group. CSV emits exactly one header; NDJSON batches require no shared format
state.
Fields§
§writer: Option<BufWriter<File>>§schema: SchemaRef§format: OutFormat§wrote_batch: bool§rows_written: usize§staging_path: Option<PathBuf>§destination: PathBuf§overwrite: boolImplementations§
Source§impl ParallelTextWriter
impl ParallelTextWriter
Sourcepub fn new(
config: WriteConfig,
schema: SchemaRef,
) -> Result<Self, ReadStatError>
pub fn new( config: WriteConfig, schema: SchemaRef, ) -> Result<Self, ReadStatError>
Creates a transactional parallel CSV or NDJSON writer.
§Errors
Returns an error for invalid output configuration or staging-file creation failure.
Sourcepub fn write(&mut self, batches: &[RecordBatch]) -> Result<(), ReadStatError>
pub fn write(&mut self, batches: &[RecordBatch]) -> Result<(), ReadStatError>
Encodes a bounded group of batches concurrently and writes the encoded
buffers in the same order as batches.
§Errors
Returns an error for a schema mismatch, row-count overflow, text encoding failure, or output I/O failure.
Trait Implementations§
Source§impl Drop for ParallelTextWriter
Available on (crate features csv or ndjson) and non-WebAssembly only.
impl Drop for ParallelTextWriter
Available on (crate features
csv or ndjson) and non-WebAssembly only.Auto Trait Implementations§
impl Freeze for ParallelTextWriter
impl RefUnwindSafe for ParallelTextWriter
impl Send for ParallelTextWriter
impl Sync for ParallelTextWriter
impl Unpin for ParallelTextWriter
impl UnsafeUnpin for ParallelTextWriter
impl UnwindSafe for ParallelTextWriter
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more