parquet::file::metadata

Struct ParquetMetaDataBuilder

Source
pub struct ParquetMetaDataBuilder(ParquetMetaData);
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();

Tuple Fields§

§0: ParquetMetaData

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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.
§

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

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T