pub struct ReadStatWriter {
pub(crate) wtr: Option<ReadStatWriterFormat>,
pub(crate) wrote_header: bool,
pub(crate) wrote_start: bool,
config: WriteConfig,
schema: SchemaRef,
rows_written: usize,
staging_path: Option<PathBuf>,
}Expand description
Fields§
§wtr: Option<ReadStatWriterFormat>The format-specific writer, created on first write.
wrote_header: boolWhether the CSV header row has been written.
wrote_start: boolWhether any data has been written (controls file creation vs. append).
config: WriteConfig§schema: SchemaRef§rows_written: usize§staging_path: Option<PathBuf>Implementations§
Source§impl ReadStatWriter
impl ReadStatWriter
Sourcepub fn new(
config: WriteConfig,
schema: SchemaRef,
) -> Result<Self, ReadStatError>
pub fn new( config: WriteConfig, schema: SchemaRef, ) -> Result<Self, ReadStatError>
Creates a new ReadStatWriter with no active writer.
Sourcefn open_output(&mut self, wc: &WriteConfig) -> Result<File, ReadStatError>
fn open_output(&mut self, wc: &WriteConfig) -> Result<File, ReadStatError>
Opens a sibling staging file. Called exactly once per output; successful finalization publishes it to the configured destination.
fn resolve_compression( compression: Option<ParquetCompression>, compression_level: Option<u32>, ) -> Result<ParquetCompressionCodec, ReadStatError>
Sourcepub fn finish(self) -> Result<usize, ReadStatError>
pub fn finish(self) -> Result<usize, ReadStatError>
Finalizes the writer, flushing and closing the underlying format writer.
Returns the total number of successfully written rows. Consuming the writer makes finalization a one-shot operation. The library does not print anything; callers own user-facing summary output.
§Errors
Returns an error if the underlying writer fails to flush or close, or if the output format is not enabled.
fn publish(&mut self) -> Result<usize, ReadStatError>
Sourcefn flush_buffered(&mut self) -> Result<(), ReadStatError>
fn flush_buffered(&mut self) -> Result<(), ReadStatError>
Flushes the buffered file writer for formats (CSV, NDJSON) whose
underlying BufWriter would otherwise flush silently in Drop.
fn finish_feather(&mut self) -> Result<(), ReadStatError>
fn finish_parquet(&mut self) -> Result<(), ReadStatError>
Sourcepub fn write(&mut self, batch: &RecordBatch) -> Result<(), ReadStatError>
pub fn write(&mut self, batch: &RecordBatch) -> Result<(), ReadStatError>
Writes a single batch of data in the format determined by wc.
Handles writer initialization on first call and CSV header writing.
§Errors
Returns an error if the output file cannot be opened, writing fails, or the output format is not enabled.
fn write_data_to_csv( &mut self, batch: &RecordBatch, wc: &WriteConfig, ) -> Result<(), ReadStatError>
fn write_data_to_feather( &mut self, batch: &RecordBatch, wc: &WriteConfig, ) -> Result<(), ReadStatError>
fn write_data_to_ndjson( &mut self, batch: &RecordBatch, wc: &WriteConfig, ) -> Result<(), ReadStatError>
fn write_data_to_parquet( &mut self, batch: &RecordBatch, wc: &WriteConfig, ) -> Result<(), ReadStatError>
fn write_data_to_stdout( &mut self, batch: &RecordBatch, ) -> Result<(), ReadStatError>
fn write_header_to_stdout(&mut self) -> Result<(), ReadStatError>
Trait Implementations§
Source§impl Drop for ReadStatWriter
impl Drop for ReadStatWriter
Auto Trait Implementations§
impl Freeze for ReadStatWriter
impl !RefUnwindSafe for ReadStatWriter
impl Send for ReadStatWriter
impl !Sync for ReadStatWriter
impl Unpin for ReadStatWriter
impl UnsafeUnpin for ReadStatWriter
impl !UnwindSafe for ReadStatWriter
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
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>
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>
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