adamreeve commented on code in PR #8305:
URL: https://github.com/apache/arrow-rs/pull/8305#discussion_r2543797434
##########
parquet/src/file/metadata/thrift/mod.rs:
##########
@@ -1197,13 +1197,30 @@ pub(super) fn serialize_column_meta_data<W: Write>(
if let Some(dictionary_page_offset) = column_chunk.dictionary_page_offset {
last_field_id = dictionary_page_offset.write_thrift_field(w, 11,
last_field_id)?;
}
- // PageStatistics is the same as thrift Statistics, but writable
- let stats = page_stats_to_thrift(column_chunk.statistics());
- if let Some(stats) = stats {
- last_field_id = stats.write_thrift_field(w, 12, last_field_id)?;
+
+ // Only write statistics to plaintext footer if column is not encrypted
+
+ #[cfg(feature = "encryption")]
+ if column_chunk.crypto_metadata().is_none() {
Review Comment:
The contents of these two blocks is the same, so we could tidy this up by
adding a new function to decide whether to write stats and remove the inline
`#[cfg()]` here, eg:
```rust
#[cfg(feature = "encryption")]
fn should_write_column_stats(column_chunk: &ColumnChunkMetaData) -> bool {
// If there is encrypted column metadata present,
// the column is encrypted with a different key to the footer or a
plaintext footer is used,
// so the statistics are sensitive and shouldn't be written.
column_chunk.encrypted_column_metadata.is_none()
}
#[cfg(not(feature = "encryption"))]
fn should_write_column_stats(column_chunk: &ColumnChunkMetaData) -> bool {
true
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]