Skip to main content

ParxWriter

Struct ParxWriter 

Source
pub struct ParxWriter { /* private fields */ }
Expand description

Writer for PARX sidecar files.

Builds a PARX file from Parquet footer bytes and optional extensions.

Implementations§

Source§

impl ParxWriter

Source

pub fn new() -> Self

Create a new PARX writer.

Source

pub fn from_parquet_bytes(data: &[u8]) -> Result<Self>

Create a writer pre-populated from in-memory Parquet bytes.

Validates the PAR1 magic, extracts the footer, and sets source_size.

Source

pub fn from_parquet_file(path: impl AsRef<Path>) -> Result<Self>

Create a writer pre-populated from a Parquet file on disk.

Reads the file tail, validates PAR1 magic, extracts the footer, and sets both source_size and source_uri.

Source

pub fn set_source_uri(&mut self, uri: impl Into<String>)

Set the source Parquet file URI (optional, informational).

Source

pub fn set_source_size(&mut self, size: u64)

Set the source Parquet file size (required for validation).

Set the Parquet footer bytes to cache.

Set the Parquet footer bytes to cache (move version, avoids copy when possible).

Source

pub fn set_compression(&mut self, compression: Compression)

Set the compression algorithm for the footer.

Source

pub fn clear_compression(&mut self)

Clear compression (store footer uncompressed).

Source

pub fn auto_compress(&mut self)

Enable auto-compression if footer exceeds threshold.

Uses Zstd compression for footers larger than 10KB.

Source

pub const fn compression(&self) -> Option<Compression>

Get the current compression setting.

Source

pub const fn source_size(&self) -> u64

Get the source Parquet file size.

Source

pub fn footer_size(&self) -> usize

Get the cached footer size in bytes.

Source

pub fn set_page_indexes(&mut self, bytes: &[u8])

Set the page index bytes to cache.

Page indexes include ColumnIndex and OffsetIndex structures from Parquet V2. These are concatenated together in the order they appear in the file.

Source

pub fn set_page_indexes_owned(&mut self, bytes: impl Into<Bytes>)

Set the page index bytes to cache (move version, avoids copy when possible).

Source

pub fn has_page_indexes(&self) -> bool

Check if page indexes have been added.

Source

pub fn finish(self) -> Vec<u8>

Build the PARX file bytes.

Layout:

  • Header (16 bytes)
  • Footer payload (variable, possibly compressed)
  • Page index payload (variable, optional, possibly compressed)
  • Manifest (variable, Protobuf)
  • Trailer (12 bytes)
§Panics

Panics if manifest exceeds 4GB.

Trait Implementations§

Source§

impl Debug for ParxWriter

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ParxWriter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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>,

Source§

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>,

Source§

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.