-
Notifications
You must be signed in to change notification settings - Fork 810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ColumnChunkMetadataBuilder
clear APIs
#6523
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1205,15 +1205,34 @@ impl ColumnChunkMetaData { | |
|
||
/// Converts this [`ColumnChunkMetaData`] into a [`ColumnChunkMetaDataBuilder`] | ||
pub fn into_builder(self) -> ColumnChunkMetaDataBuilder { | ||
ColumnChunkMetaDataBuilder(self) | ||
ColumnChunkMetaDataBuilder::from(self) | ||
} | ||
} | ||
|
||
/// Builder for column chunk metadata. | ||
/// Builder for [`ColumnChunkMetaData`] | ||
/// | ||
/// This builder is used to create a new column chunk metadata or modify an | ||
/// existing one. | ||
/// | ||
/// # Example | ||
/// ```no_run | ||
/// # use parquet::file::metadata::{ColumnChunkMetaData, ColumnChunkMetaDataBuilder}; | ||
/// # fn get_column_chunk_metadata() -> ColumnChunkMetaData { unimplemented!(); } | ||
/// let column_chunk_metadata = get_column_chunk_metadata(); | ||
/// // create a new builder from existing column chunk metadata | ||
/// let builder = ColumnChunkMetaDataBuilder::from(column_chunk_metadata); | ||
/// // clear the statistics: | ||
/// let column_chunk_metadata: ColumnChunkMetaData = builder | ||
/// .clear_statistics() | ||
/// .build() | ||
/// .unwrap(); | ||
/// ``` | ||
pub struct ColumnChunkMetaDataBuilder(ColumnChunkMetaData); | ||
|
||
impl ColumnChunkMetaDataBuilder { | ||
/// Creates new column chunk metadata builder. | ||
/// | ||
/// See also [`ColumnChunkMetaData::builder`] | ||
fn new(column_descr: ColumnDescPtr) -> Self { | ||
Self(ColumnChunkMetaData { | ||
column_descr, | ||
|
@@ -1297,7 +1316,7 @@ impl ColumnChunkMetaDataBuilder { | |
self | ||
} | ||
|
||
/// Sets optional dictionary page ofset in bytes. | ||
/// Sets optional dictionary page offset in bytes. | ||
pub fn set_dictionary_page_offset(mut self, value: Option<i64>) -> Self { | ||
self.0.dictionary_page_offset = value; | ||
self | ||
|
@@ -1315,12 +1334,24 @@ impl ColumnChunkMetaDataBuilder { | |
self | ||
} | ||
|
||
/// Clears the statistics for this column chunk. | ||
pub fn clear_statistics(mut self) -> Self { | ||
self.0.statistics = None; | ||
self | ||
} | ||
|
||
/// Sets page encoding stats for this column chunk. | ||
pub fn set_page_encoding_stats(mut self, value: Vec<PageEncodingStats>) -> Self { | ||
self.0.encoding_stats = Some(value); | ||
self | ||
} | ||
|
||
/// Clears the page encoding stats for this column chunk. | ||
pub fn clear_page_encoding_stats(mut self) -> Self { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same reasoning applies to this API |
||
self.0.encoding_stats = None; | ||
self | ||
} | ||
|
||
/// Sets optional bloom filter offset in bytes. | ||
pub fn set_bloom_filter_offset(mut self, value: Option<i64>) -> Self { | ||
self.0.bloom_filter_offset = value; | ||
|
@@ -1492,6 +1523,12 @@ impl ColumnIndexBuilder { | |
} | ||
} | ||
|
||
impl From<ColumnChunkMetaData> for ColumnChunkMetaDataBuilder { | ||
fn from(value: ColumnChunkMetaData) -> Self { | ||
ColumnChunkMetaDataBuilder(value) | ||
} | ||
} | ||
|
||
/// Builder for offset index, part of the Parquet [PageIndex]. | ||
/// | ||
/// [PageIndex]: https://github.com/apache/parquet-format/blob/master/PageIndex.md | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately,
set_statistics
takesvalue: Statistics
notvalue: Option<Statistics>
and thus there is no way to make this change without breaking the API which we can't do until the next breaking release