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:648–674  ·  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

646
647
648def test_encrypted_parquet_loop(tempdir, data_table, basic_encryption_config):
649 """Write an encrypted parquet, verify it's encrypted,
650 and then read it multithreaded in a loop."""
651 path = tempdir / PARQUET_NAME
652
653 # Encrypt the footer with the footer key,
654 # encrypt column `a` and column `b` with another key,
655 # keep `c` plaintext, defined in basic_encryption_config
656 kms_connection_config, crypto_factory = write_encrypted_file(
657 path, data_table, FOOTER_KEY_NAME, COL_KEY_NAME, FOOTER_KEY, COL_KEY,
658 basic_encryption_config)
659
660 verify_file_encrypted(path)
661
662 decryption_config = pe.DecryptionConfiguration(
663 cache_lifetime=timedelta(minutes=5.0))
664
665 for i in range(50):
666 # Read with decryption properties
667 file_decryption_properties = crypto_factory.file_decryption_properties(
668 kms_connection_config, decryption_config)
669 assert file_decryption_properties is not None
670
671 result = pq.ParquetFile(
672 path, decryption_properties=file_decryption_properties)
673 result_table = result.read(use_threads=True)
674 assert data_table.equals(result_table)
675
676
677def 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