emkornfield commented on code in PR #36574:
URL: https://github.com/apache/arrow/pull/36574#discussion_r1278325164


##########
cpp/src/parquet/page_index.cc:
##########
@@ -309,6 +313,33 @@ class RowGroupPageIndexReaderImpl : public 
RowGroupPageIndexReader {
     }
   }
 
+  /// Get decryptor if the file is encrypted
+  std::shared_ptr<Decryptor> GetColumnMetaDecryptor(
+      const ColumnCryptoMetaData* crypto_metadata, int column_ordinal,
+      int8_t module_type) const {
+    std::shared_ptr<Decryptor> decryptor;
+    if (crypto_metadata != nullptr) {
+      if (file_decryptor_ == nullptr) {
+        throw ParquetException("RowGroup is noted as encrypted but no file 
decryptor");
+      }
+      if (crypto_metadata->encrypted_with_footer_key()) {
+        // The column is encrypted with footer key
+        decryptor = file_decryptor_->GetFooterDecryptorForColumnMeta();
+      } else {
+        // The column is encrypted with its own key
+        const std::string column_key_metadata = 
crypto_metadata->key_metadata();
+        const std::string column_path = 
crypto_metadata->path_in_schema()->ToDotString();
+        decryptor =
+            file_decryptor_->GetColumnMetaDecryptor(column_path, 
column_key_metadata);
+      }
+      ARROW_DCHECK(!decryptor->file_aad().empty());

Review Comment:
   Does this represent an internal bug, or some sort of configuration error?  
If the latter an exception should probably be raised.



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

Reply via email to