adamreeve commented on code in PR #7439:
URL: https://github.com/apache/arrow-rs/pull/7439#discussion_r2076273560


##########
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:
   The other method would only need to be defined when encryption is enabled, 
I'll make a change to demonstrate what I mean.



-- 
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

Reply via email to