Struct parquet::file::writer::SerializedFileWriter

source ·
pub struct SerializedFileWriter<W: Write> { /* private fields */ }
Expand description

Parquet file writer API. Provides methods to write row groups sequentially.

The main workflow should be as following:

  • Create file writer, this will open a new file and potentially write some metadata.
  • Request a new row group writer by calling next_row_group.
  • Once finished writing row group, close row group writer by calling close
  • Write subsequent row groups, if necessary.
  • After all row groups have been written, close the file writer using close method.

Implementations§

source§

impl<W: Write + Send> SerializedFileWriter<W>

source

pub fn new( buf: W, schema: TypePtr, properties: WriterPropertiesPtr, ) -> Result<Self>

Creates new file writer.

source

pub fn next_row_group(&mut self) -> Result<SerializedRowGroupWriter<'_, W>>

Creates new row group from this file writer. In case of IO error or Thrift error, returns Err.

There is no limit on a number of row groups in a file; however, row groups have to be written sequentially. Every time the next row group is requested, the previous row group must be finalised and closed using RowGroupWriter::close method.

source

pub fn flushed_row_groups(&self) -> &[RowGroupMetaDataPtr]

Returns metadata for any flushed row groups

source

pub fn finish(&mut self) -> Result<FileMetaData>

Close and finalize the underlying Parquet writer

Unlike Self::close this does not consume self

Attempting to write after calling finish will result in an error

source

pub fn close(self) -> Result<FileMetaData>

Closes and finalises file writer, returning the file metadata.

source

pub fn append_key_value_metadata(&mut self, kv_metadata: KeyValue)

source

pub fn schema_descr(&self) -> &SchemaDescriptor

Returns a reference to schema descriptor.

source

pub fn properties(&self) -> &WriterPropertiesPtr

Returns a reference to the writer properties

source

pub fn inner(&self) -> &W

Returns a reference to the underlying writer.

source

pub fn inner_mut(&mut self) -> &mut W

Returns a mutable reference to the underlying writer.

It is inadvisable to directly write to the underlying writer.

source

pub fn into_inner(self) -> Result<W>

Writes the file footer and returns the underlying writer.

source

pub fn bytes_written(&self) -> usize

Returns the number of bytes written to this instance

Trait Implementations§

source§

impl<W: Write> Debug for SerializedFileWriter<W>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<W> Freeze for SerializedFileWriter<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for SerializedFileWriter<W>
where W: RefUnwindSafe,

§

impl<W> Send for SerializedFileWriter<W>
where W: Send,

§

impl<W> Sync for SerializedFileWriter<W>
where W: Sync,

§

impl<W> Unpin for SerializedFileWriter<W>
where W: Unpin,

§

impl<W> UnwindSafe for SerializedFileWriter<W>
where W: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,