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


##########
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:
   Issue is that when `#[cfg(not(feature = "encryption"))]` the `FileEncryptor` 
type doesn't exist and we cannot have a 
`MetadataObjectWriter::get_footer_encryption_algorithm(file_encryptor: 
&FileEncryptor)` which we would want to call here (in both `#[cfg(feature = 
"encryption")]` and `#[cfg(not(feature = "encryption"))]` cases):
   
https://github.com/apache/arrow-rs/blob/1ab252b81303adf70ed56a33f3d396507e389a57/parquet/src/file/metadata/writer.rs#L148-L160



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