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
impl ParquetMetaDataBuilder
Sourcepub fn new(file_meta_data: FileMetaData) -> Self
pub fn new(file_meta_data: FileMetaData) -> Self
Create a new builder from a file metadata, with no row groups
Sourcepub fn new_from_metadata(metadata: ParquetMetaData) -> Self
pub fn new_from_metadata(metadata: ParquetMetaData) -> Self
Create a new builder from an existing ParquetMetaData
Sourcepub fn add_row_group(self, row_group: RowGroupMetaData) -> Self
pub fn add_row_group(self, row_group: RowGroupMetaData) -> Self
Adds a row group to the metadata
Sourcepub fn set_row_groups(self, row_groups: Vec<RowGroupMetaData>) -> Self
pub fn set_row_groups(self, row_groups: Vec<RowGroupMetaData>) -> Self
Sets all the row groups to the specified list
Sourcepub fn take_row_groups(&mut self) -> Vec<RowGroupMetaData>
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.
Sourcepub fn row_groups(&self) -> &[RowGroupMetaData]
pub fn row_groups(&self) -> &[RowGroupMetaData]
Return a reference to the current row groups
Sourcepub fn set_column_index(self, column_index: Option<ParquetColumnIndex>) -> Self
pub fn set_column_index(self, column_index: Option<ParquetColumnIndex>) -> Self
Sets the column index
Sourcepub fn take_column_index(&mut self) -> Option<ParquetColumnIndex>
pub fn take_column_index(&mut self) -> Option<ParquetColumnIndex>
Returns the current column index from the builder, replacing it with None
Sourcepub fn column_index(&self) -> Option<&ParquetColumnIndex>
pub fn column_index(&self) -> Option<&ParquetColumnIndex>
Return a reference to the current column index, if any
Sourcepub fn set_offset_index(self, offset_index: Option<ParquetOffsetIndex>) -> Self
pub fn set_offset_index(self, offset_index: Option<ParquetOffsetIndex>) -> Self
Sets the offset index
Sourcepub fn take_offset_index(&mut self) -> Option<ParquetOffsetIndex>
pub fn take_offset_index(&mut self) -> Option<ParquetOffsetIndex>
Returns the current offset index from the builder, replacing it with None
Sourcepub fn offset_index(&self) -> Option<&ParquetOffsetIndex>
pub fn offset_index(&self) -> Option<&ParquetOffsetIndex>
Return a reference to the current offset index, if any
Sourcepub fn build(self) -> ParquetMetaData
pub fn build(self) -> ParquetMetaData
Creates a new ParquetMetaData from the builder
Trait Implementations§
Source§impl From<ParquetMetaData> for ParquetMetaDataBuilder
impl From<ParquetMetaData> for ParquetMetaDataBuilder
Source§fn from(meta_data: ParquetMetaData) -> Self
fn from(meta_data: ParquetMetaData) -> Self
Auto Trait Implementations§
impl Freeze for ParquetMetaDataBuilder
impl RefUnwindSafe for ParquetMetaDataBuilder
impl Send for ParquetMetaDataBuilder
impl Sync for ParquetMetaDataBuilder
impl Unpin for ParquetMetaDataBuilder
impl UnwindSafe for ParquetMetaDataBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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