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