pub struct SerializedRowGroupWriter<'a, W: Write> { /* private fields */ }Expand description
Parquet row group writer API.
Provides methods to access column writers in an iterator-like fashion, order is guaranteed to match the order of schema leaves (column descriptors).
All columns should be written sequentially; the main workflow is:
- Request the next column using
next_columnmethod - this will returnNoneif no more columns are available to write. - Once done writing a column, close column writer with
close - Once all columns have been written, close row group writer with
closemethod. The close method will return row group metadata and is no-op on already closed row group.
Implementations§
Source§impl<'a, W: Write + Send> SerializedRowGroupWriter<'a, W>
impl<'a, W: Write + Send> SerializedRowGroupWriter<'a, W>
Sourcepub fn new(
schema_descr: SchemaDescPtr,
properties: WriterPropertiesPtr,
buf: &'a mut TrackedWrite<W>,
row_group_index: i16,
on_close: Option<OnCloseRowGroup<'a, W>>,
) -> Self
pub fn new( schema_descr: SchemaDescPtr, properties: WriterPropertiesPtr, buf: &'a mut TrackedWrite<W>, row_group_index: i16, on_close: Option<OnCloseRowGroup<'a, W>>, ) -> Self
Creates a new SerializedRowGroupWriter with:
schema_descr- the schema to writeproperties- writer propertiesbuf- the buffer to write data torow_group_index- row group index in this parquet file.file_offset- file offset of this row group in this parquet file.on_close- an optional callback that will invoked onSelf::close
Sourcepub fn next_column(&mut self) -> Result<Option<SerializedColumnWriter<'_>>>
pub fn next_column(&mut self) -> Result<Option<SerializedColumnWriter<'_>>>
Returns the next column writer, if available; otherwise returns None.
In case of any IO error or Thrift error, or if row group writer has already been
closed returns Err.
Sourcepub fn append_column<R: ChunkReader>(
&mut self,
reader: &R,
close: ColumnCloseResult,
) -> Result<()>
pub fn append_column<R: ChunkReader>( &mut self, reader: &R, close: ColumnCloseResult, ) -> Result<()>
Append an encoded column chunk from reader directly to the underlying
writer.
This method can be used for efficiently concatenating or projecting Parquet data, or encoding Parquet data to temporary in-memory buffers.
Arguments:
reader: aChunkReadercontaining the encoded column dataclose: theColumnCloseResultmetadata returned from closing the column writer that wrote the data inreader.
See Also:
get_column_writerfor creating writers that can encode data.Self::next_columnfor writing data that isn’t already encoded
Sourcepub fn close(self) -> Result<RowGroupMetaDataPtr>
pub fn close(self) -> Result<RowGroupMetaDataPtr>
Closes this row group writer and returns row group metadata.