adamreeve commented on code in PR #7439: URL: https://github.com/apache/arrow-rs/pull/7439#discussion_r2074469072
########## parquet/src/file/metadata/writer.rs: ########## @@ -622,25 +635,30 @@ impl MetadataObjectWriter { } } - fn file_crypto_metadata( - file_encryptor: &FileEncryptor, - ) -> Result<crate::format::FileCryptoMetaData> { - let properties = file_encryptor.properties(); - let supply_aad_prefix = properties - .aad_prefix() - .map(|_| !properties.store_aad_prefix()); - let encryption_algorithm = AesGcmV1 { - aad_prefix: if properties.store_aad_prefix() { - properties.aad_prefix().cloned() - } else { - None - }, - aad_file_unique: Some(file_encryptor.aad_file_unique().clone()), - supply_aad_prefix, - }; + fn get_footer_encryption_algorithm(&self) -> Option<EncryptionAlgorithm> { + if let Some(file_encryptor) = &self.file_encryptor { + let supply_aad_prefix = file_encryptor + .properties() + .aad_prefix() + .map(|_| !file_encryptor.properties().store_aad_prefix()); + let encryption_algorithm = EncryptionAlgorithm::AESGCMV1(AesGcmV1 { + aad_prefix: if file_encryptor.properties().store_aad_prefix() { + file_encryptor.properties().aad_prefix().cloned() + } else { + None + }, + aad_file_unique: Some(file_encryptor.aad_file_unique().clone()), + supply_aad_prefix, + }); + return Some(encryption_algorithm); + } + None + } + fn file_crypto_metadata(&self) -> Result<crate::format::FileCryptoMetaData> { + let properties = self.file_encryptor.as_ref().unwrap().properties(); Review Comment: Rather than having these unwraps, can we convert this back to a method that takes `&FileEncryptor` and split out part of `get_footer_encryption_algorithm` into another method that also takes `&FileEncryptor` and doesn't return an option? -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org