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:653–679  ·  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

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