MCPcopy Create free account
hub / github.com/apache/arrow / test_encrypted_parquet_loop

Function test_encrypted_parquet_loop

python/pyarrow/tests/parquet/test_encryption.py:788–814  ·  view source on GitHub ↗

Write an encrypted parquet, verify it's encrypted, and then read it multithreaded in a loop.

(tempdir, data_table, basic_encryption_config)

Source from the content-addressed store, hash-verified

786
787
788def test_encrypted_parquet_loop(tempdir, data_table, basic_encryption_config):
789 """Write an encrypted parquet, verify it's encrypted,
790 and then read it multithreaded in a loop."""
791 path = tempdir / PARQUET_NAME
792
793 # Encrypt the footer with the footer key,
794 # encrypt column `a` and column `b` with another key,
795 # keep `c` plaintext, defined in basic_encryption_config
796 kms_connection_config, crypto_factory = write_encrypted_file(
797 path, data_table, FOOTER_KEY_NAME, COL_KEY_NAME, FOOTER_KEY, COL_KEY,
798 basic_encryption_config)
799
800 verify_file_encrypted(path)
801
802 decryption_config = pe.DecryptionConfiguration(
803 cache_lifetime=timedelta(minutes=5.0))
804
805 for i in range(50):
806 # Read with decryption properties
807 file_decryption_properties = crypto_factory.file_decryption_properties(
808 kms_connection_config, decryption_config)
809 assert file_decryption_properties is not None
810
811 result = pq.ParquetFile(
812 path, decryption_properties=file_decryption_properties)
813 result_table = result.read(use_threads=True)
814 assert data_table.equals(result_table)
815
816
817def test_read_with_deleted_crypto_factory(tempdir, data_table, basic_encryption_config):

Callers

nothing calls this directly

Calls 4

readMethod · 0.95
verify_file_encryptedFunction · 0.90
write_encrypted_fileFunction · 0.85
equalsMethod · 0.80

Tested by

no test coverage detected