pub struct FileWriter<W: Write> { /* private fields */ }
Expand description
An interface to write a parquet file.
Use start
to write the header, write
to write a row group,
and end
to write the footer.
Implementations§
Source§impl<W: Write> FileWriter<W>
impl<W: Write> FileWriter<W>
Sourcepub fn options(&self) -> &WriteOptions
pub fn options(&self) -> &WriteOptions
The options assigned to the file
Sourcepub fn schema(&self) -> &SchemaDescriptor
pub fn schema(&self) -> &SchemaDescriptor
The SchemaDescriptor
assigned to this file
Sourcepub fn metadata(&self) -> Option<&ThriftFileMetadata>
pub fn metadata(&self) -> Option<&ThriftFileMetadata>
Returns the ThriftFileMetadata
. This is Some iff the Self::end
has been called.
This is used to write the metadata as a separate Parquet file, usually when data is partitioned across multiple files
Source§impl<W: Write> FileWriter<W>
impl<W: Write> FileWriter<W>
Sourcepub fn new(
writer: W,
schema: SchemaDescriptor,
options: WriteOptions,
created_by: Option<String>,
) -> Self
pub fn new( writer: W, schema: SchemaDescriptor, options: WriteOptions, created_by: Option<String>, ) -> Self
Returns a new FileWriter
.
Sourcepub fn write<E>(
&mut self,
row_group: RowGroupIterColumns<'_, E>,
) -> ParquetResult<()>
pub fn write<E>( &mut self, row_group: RowGroupIterColumns<'_, E>, ) -> ParquetResult<()>
Writes a row group to the file.
This call is IO-bounded
Sourcepub fn end(
&mut self,
key_value_metadata: Option<Vec<KeyValue>>,
) -> ParquetResult<u64>
pub fn end( &mut self, key_value_metadata: Option<Vec<KeyValue>>, ) -> ParquetResult<u64>
Writes the footer of the parquet file. Returns the total size of the file and the underlying writer.
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Returns the underlying writer.
Sourcepub fn into_inner_and_metadata(self) -> (W, ThriftFileMetadata)
pub fn into_inner_and_metadata(self) -> (W, ThriftFileMetadata)
Returns the underlying writer and ThriftFileMetadata
§Panics
This function panics if Self::end
has not yet been called
Auto Trait Implementations§
impl<W> Freeze for FileWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for FileWriter<W>where
W: RefUnwindSafe,
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>where
W: 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
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