Struct parquet::file::metadata::ParquetMetaDataBuilder

source ·
pub struct ParquetMetaDataBuilder(/* private fields */);
Expand description

A builder for creating / manipulating ParquetMetaData

§Example creating a new ParquetMetaData

 // Create a new builder given the file metadata
 let file_metadata = get_file_metadata();
 // Create a row group
 let row_group = RowGroupMetaData::builder(file_metadata.schema_descr_ptr())
    .set_num_rows(100)
    // ... (A real row group needs more than just the number of rows)
    .build()
    .unwrap();
 // Create the final metadata
 let metadata: ParquetMetaData = ParquetMetaDataBuilder::new(file_metadata)
   .add_row_group(row_group)
   .build();

§Example modifying an existing ParquetMetaData

// Modify the metadata so only the last RowGroup remains
let metadata: ParquetMetaData = load_metadata();
let mut builder = metadata.into_builder();

// Take existing row groups to modify
let mut row_groups = builder.take_row_groups();
let last_row_group = row_groups.pop().unwrap();

let metadata = builder
  .add_row_group(last_row_group)
  .build();

Implementations§

source§

impl ParquetMetaDataBuilder

source

pub fn new(file_meta_data: FileMetaData) -> Self

Create a new builder from a file metadata, with no row groups

source

pub fn new_from_metadata(metadata: ParquetMetaData) -> Self

Create a new builder from an existing ParquetMetaData

source

pub fn add_row_group(self, row_group: RowGroupMetaData) -> Self

Adds a row group to the metadata

source

pub fn set_row_groups(self, row_groups: Vec<RowGroupMetaData>) -> Self

Sets all the row groups to the specified list

source

pub fn take_row_groups(&mut self) -> Vec<RowGroupMetaData>

Takes ownership of the row groups in this builder, and clears the list of row groups.

This can be used for more efficient creation of a new ParquetMetaData from an existing one.

source

pub fn row_groups(&self) -> &[RowGroupMetaData]

Return a reference to the current row groups

source

pub fn set_column_index(self, column_index: Option<ParquetColumnIndex>) -> Self

Sets the column index

source

pub fn take_column_index(&mut self) -> Option<ParquetColumnIndex>

Returns the current column index from the builder, replacing it with None

source

pub fn column_index(&self) -> Option<&ParquetColumnIndex>

Return a reference to the current column index, if any

source

pub fn set_offset_index(self, offset_index: Option<ParquetOffsetIndex>) -> Self

Sets the offset index

source

pub fn take_offset_index(&mut self) -> Option<ParquetOffsetIndex>

Returns the current offset index from the builder, replacing it with None

source

pub fn offset_index(&self) -> Option<&ParquetOffsetIndex>

Return a reference to the current offset index, if any

source

pub fn build(self) -> ParquetMetaData

Creates a new ParquetMetaData from the builder

Trait Implementations§

source§

impl From<ParquetMetaData> for ParquetMetaDataBuilder

source§

fn from(meta_data: ParquetMetaData) -> Self

Converts to this type from the input type.

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

§

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,