pub struct FileWriter<W: Write> { /* private fields */ }
io_ipc
only.Expand description
Arrow file writer
Implementations§
Source§impl<R: Read + Seek + Write> FileWriter<R>
impl<R: Read + Seek + Write> FileWriter<R>
Sourcepub fn try_from_file(
writer: R,
metadata: FileMetadata,
options: WriteOptions,
) -> PolarsResult<FileWriter<R>>
pub fn try_from_file( writer: R, metadata: FileMetadata, options: WriteOptions, ) -> PolarsResult<FileWriter<R>>
Creates a new FileWriter
from an existing file, seeking to the last message
and appending new messages afterwards. Users call finish
to write the footer (with both)
the existing and appended messages on it.
§Error
This function errors iff:
- the file’s endianness is not the native endianness (not yet supported)
- the file is not a valid Arrow IPC file
Source§impl<W: Write> FileWriter<W>
impl<W: Write> FileWriter<W>
Sourcepub fn try_new(
writer: W,
schema: ArrowSchemaRef,
ipc_fields: Option<Vec<IpcField>>,
options: WriteOptions,
) -> PolarsResult<Self>
pub fn try_new( writer: W, schema: ArrowSchemaRef, ipc_fields: Option<Vec<IpcField>>, options: WriteOptions, ) -> PolarsResult<Self>
Creates a new FileWriter
and writes the header to writer
Sourcepub fn new(
writer: W,
schema: ArrowSchemaRef,
ipc_fields: Option<Vec<IpcField>>,
options: WriteOptions,
) -> Self
pub fn new( writer: W, schema: ArrowSchemaRef, ipc_fields: Option<Vec<IpcField>>, options: WriteOptions, ) -> Self
Creates a new FileWriter
.
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Consumes itself into the inner writer
Sourcepub fn get_scratches(&mut self) -> EncodedData
pub fn get_scratches(&mut self) -> EncodedData
Get the inner memory scratches so they can be reused in a new writer. This can be utilized to save memory allocations for performance reasons.
Sourcepub fn set_scratches(&mut self, scratches: EncodedData)
pub fn set_scratches(&mut self, scratches: EncodedData)
Set the inner memory scratches so they can be reused in a new writer. This can be utilized to save memory allocations for performance reasons.
Sourcepub fn start(&mut self) -> PolarsResult<()>
pub fn start(&mut self) -> PolarsResult<()>
Writes the header and first (schema) message to the file.
§Errors
Errors if the file has been started or has finished.
Sourcepub fn write(
&mut self,
chunk: &RecordBatchT<Box<dyn Array>>,
ipc_fields: Option<&[IpcField]>,
) -> PolarsResult<()>
pub fn write( &mut self, chunk: &RecordBatchT<Box<dyn Array>>, ipc_fields: Option<&[IpcField]>, ) -> PolarsResult<()>
Writes RecordBatchT
to the file
pub fn write_encoded( &mut self, encoded_dictionaries: &[EncodedData], encoded_message: &EncodedData, ) -> PolarsResult<()>
pub fn write_encoded_record_batch( &mut self, encoded_message: &EncodedData, ) -> PolarsResult<()>
Sourcepub fn finish(&mut self) -> PolarsResult<()>
pub fn finish(&mut self) -> PolarsResult<()>
Write footer and closing tag, then mark the writer as done
Sourcepub fn set_custom_schema_metadata(&mut self, custom_metadata: Arc<Metadata>)
pub fn set_custom_schema_metadata(&mut self, custom_metadata: Arc<Metadata>)
Sets custom schema metadata. Must be called before start
is called
Auto Trait Implementations§
impl<W> Freeze for FileWriter<W>where
W: Freeze,
impl<W> !RefUnwindSafe for FileWriter<W>
impl<W> Send for FileWriter<W>where
W: Send,
impl<W> Sync for FileWriter<W>where
W: Sync,
impl<W> Unpin for FileWriter<W>where
W: Unpin,
impl<W> !UnwindSafe for FileWriter<W>
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