Skip to content

Commit a6a3ec2

Browse files
committed
Always encrypt when uniform encryption
1 parent 31df47d commit a6a3ec2

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

parquet/src/file/metadata/writer.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -758,17 +758,11 @@ impl MetadataObjectWriter {
758758
let encryptor = match column_chunk.column_crypto_metadata.as_deref() {
759759
None => None,
760760
Some(ColumnCryptoMetaData::ENCRYPTION_WITH_FOOTER_KEY) => {
761-
let is_footer_encrypted = file_encryptor.properties().encrypt_footer();
762-
763-
// When uniform encryption is used the footer is already encrypted,
764-
// so the column chunk does not need additional encryption.
765-
// Except if we're in plaintext footer mode, then we need to encrypt
766-
// the column metadata here.
767-
if !is_footer_encrypted {
768-
Some(file_encryptor.get_footer_encryptor()?)
769-
} else {
770-
None
771-
}
761+
// We always encrypt column metadata separately and store in
762+
// encrypted_column_metadata. This allows skipping the plaintext meta_data
763+
// field in the writer to reduce footer size. If encrypted_column_metadata
764+
// were not set, the reader would not be able to read the column metadata.
765+
Some(file_encryptor.get_footer_encryptor()?)
772766
}
773767
Some(ColumnCryptoMetaData::ENCRYPTION_WITH_COLUMN_KEY(col_key)) => {
774768
let column_path = col_key.path_in_schema.join(".");

0 commit comments

Comments
 (0)