rok commented on code in PR #39438:
URL: https://github.com/apache/arrow/pull/39438#discussion_r1592735081


##########
python/pyarrow/_dataset_parquet.pyx:
##########
@@ -808,6 +815,18 @@ cdef class ParquetFragmentScanOptions(FragmentScanOptions):
             raise ValueError("size must be larger than zero")
         self.reader_properties().set_thrift_container_size_limit(size)
 
+    def set_file_decryption_properties(self, FileDecryptionProperties 
decryption_properties):

Review Comment:
   Perhaps tests could be refactored like so:
   ```diff
   diff --git a/python/pyarrow/tests/parquet/test_encryption.py 
b/python/pyarrow/tests/parquet/test_encryption.py
   index 7fc414381..3ccb4cd02 100644
   --- a/python/pyarrow/tests/parquet/test_encryption.py
   +++ b/python/pyarrow/tests/parquet/test_encryption.py
   @@ -100,6 +100,8 @@ def write_encrypted_file(path, data_table, 
footer_key_name, col_key_name,
        write_encrypted_parquet(path, data_table, encryption_config,
                                kms_connection_config, crypto_factory)
    
   +    return kms_connection_config, crypto_factory
   +
    
    def test_encrypted_parquet_write_read(tempdir, data_table):
        """Write an encrypted parquet, verify it's encrypted, and then read 
it."""
   @@ -117,17 +119,12 @@ def test_encrypted_parquet_write_read(tempdir, 
data_table):
            cache_lifetime=timedelta(minutes=5.0),
            data_key_length_bits=256)
    
   -    write_encrypted_file(path, data_table, FOOTER_KEY_NAME, COL_KEY_NAME,
   -                         FOOTER_KEY, COL_KEY, encryption_config)
   +    kms_connection_config, crypto_factory = write_encrypted_file(
   +        path, data_table, FOOTER_KEY_NAME, COL_KEY_NAME, FOOTER_KEY, 
COL_KEY,
   +        encryption_config)
    
        verify_file_encrypted(path)
    
   -    # Setup for reading
   -    kms_connection_config, crypto_factory = setup_encryption_environment({
   -        FOOTER_KEY_NAME: FOOTER_KEY.decode("UTF-8"),
   -        COL_KEY_NAME: COL_KEY.decode("UTF-8"),
   -    })
   -
        # Read with decryption properties
        decryption_config = pe.DecryptionConfiguration(
            cache_lifetime=timedelta(minutes=5.0))
   @@ -504,17 +501,12 @@ def test_encrypted_parquet_loop(tempdir, data_table, 
basic_encryption_config):
        # Encrypt the footer with the footer key,
        # encrypt column `a` and column `b` with another key,
        # keep `c` plaintext, defined in basic_encryption_config
   -    write_encrypted_file(path, data_table, FOOTER_KEY_NAME, COL_KEY_NAME,
   -                         FOOTER_KEY, COL_KEY, basic_encryption_config)
   +    kms_connection_config, crypto_factory = write_encrypted_file(
   +        path, data_table, FOOTER_KEY_NAME, COL_KEY_NAME, FOOTER_KEY, 
COL_KEY,
   +        basic_encryption_config)
    
        verify_file_encrypted(path)
    
   -    # Setup for reading with decryption properties
   -    kms_connection_config, crypto_factory = setup_encryption_environment({
   -        FOOTER_KEY_NAME: FOOTER_KEY.decode("UTF-8"),
   -        COL_KEY_NAME: COL_KEY.decode("UTF-8"),
   -    })
   -
        decryption_config = pe.DecryptionConfiguration(
            cache_lifetime=timedelta(minutes=5.0))
        file_decryption_properties = crypto_factory.file_decryption_properties(
   @@ -531,14 +523,9 @@ def test_encrypted_parquet_read_table(tempdir, 
data_table, basic_encryption_conf
        path = tempdir / PARQUET_NAME
    
        # Write the encrypted parquet file using the utility function
   -    write_encrypted_file(path, data_table, FOOTER_KEY_NAME, COL_KEY_NAME,
   -                         FOOTER_KEY, COL_KEY, basic_encryption_config)
   -
   -    # Setup for reading with decryption properties
   -    kms_connection_config, crypto_factory = setup_encryption_environment({
   -        FOOTER_KEY_NAME: FOOTER_KEY.decode("UTF-8"),
   -        COL_KEY_NAME: COL_KEY.decode("UTF-8"),
   -    })
   +    kms_connection_config, crypto_factory = write_encrypted_file(
   +        path, data_table, FOOTER_KEY_NAME, COL_KEY_NAME, FOOTER_KEY, 
COL_KEY,
   +        basic_encryption_config)
    
        decryption_config = pe.DecryptionConfiguration(
            cache_lifetime=timedelta(minutes=5.0))
   ```



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