Skip to content
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 1 commit into from
Oct 8, 2024

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Oct 7, 2024

Which issue does this PR close?

Part of #6504

Rationale for this change

I want to use the ColumnChunkMetaDataBuilder to modify existing metadata in addition to creating new metadata, for the example in #6504.

What changes are included in this PR?

  1. Add a few ColumnChunkMetadataBuilder::clear_statistics and other clear API to modify Option fields

Are there any user-facing changes?

Some new APIs and docs

@github-actions github-actions bot added the parquet Changes to the parquet crate label Oct 7, 2024
@@ -1315,12 +1334,24 @@ impl ColumnChunkMetaDataBuilder {
self
}

/// Clears the statistics for this column chunk.
pub fn clear_statistics(mut self) -> Self {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, set_statistics takes value: Statistics not value: 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

/// 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 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same reasoning applies to this API

@alamb alamb marked this pull request as ready for review October 7, 2024 19:15
Copy link
Contributor

@etseidl etseidl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Seems straightforward enough to not need additional tests. I agree it would be nice to change the setters to take Options. That can be done in a follow-up. Thanks!

Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a pragmatic way forward to me

@tustvold tustvold merged commit 5508978 into apache:master Oct 8, 2024
16 checks passed
@alamb alamb deleted the alamb/clear_stats branch October 8, 2024 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants