External file decryptor bindings#57
Conversation
|
Thanks for opening a pull request! If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or See also: |
|
Hey @sofia-tekdatum following the pattern of file_decryption_properties I created a new SafeGetExternalFileDecryptionProperties which requires same methods at the cc side in order to fix this problem |
sofia-tekdatum
left a comment
There was a problem hiding this comment.
@cristekdatum You forgot to change the ParquetReader open method in _parquet.pyx
Please add.
sofia-tekdatum
left a comment
There was a problem hiding this comment.
Careful with copy/paste errors, they may have made you spend a lot of time debugging.
1f7542e to
a858935
Compare
|
I have updated the bindings code so that it forwards its property setter to the super class. I also fixed the test, which was failing because the configs were not set up properly and were disorganized. I rewrote the fixtures to match the config settings we have in the base_app, verified everything passes. @cristekdatum @avalerio-tkd @argmarco-tkd PTAL for final approval and merging. |
|
Also, verified the values make it successfully to the C++ side by running scripts/base_app.py and printing out values on the crypto_factory.cc code. Obviously that's not submitted, but it's the way to verify the code that originates in python makes it through to C++. |
avalerio-tkd
left a comment
There was a problem hiding this comment.
LGTM. Just a few comments. I tried following as much as possible. Thanks very much for this.
If the comments are not relevant or covered, feel free to merge.
| super().__init__(cache_lifetime=cache_lifetime) | ||
| # Initialize the pointer first so the get/set forwards work. | ||
| self.external_configuration.reset(new CExternalDecryptionConfiguration()) | ||
| super().__init__(cache_lifetime=cache_lifetime) |
There was a problem hiding this comment.
This change of order is a bit scary. Why is there a dependency on the subclass before calling the init of the superclass? Primarily for my understanding, but let's improve the comment.
There was a problem hiding this comment.
Updated comment. Because the super class constructor will invoke the setters that are overridden below, so they need the pointer to be ready, otherwise we get a null crash.
| cdef shared_ptr[CExternalDecryptionConfiguration] external_configuration | ||
| cdef inline shared_ptr[CExternalDecryptionConfiguration] unwrap_external(self) nogil | ||
|
|
||
| cdef shared_ptr[CCryptoFactory] pyarrow_unwrap_cryptofactory(object crypto_factory) except * |
There was a problem hiding this comment.
I'm assuming moving the definitions here is just for readability and nothing functional, right?
| CFileEncryptionProperties, | ||
| CExternalFileEncryptionProperties, | ||
| CFileDecryptionProperties, | ||
| CExternalFileDecryptionProperties, |
There was a problem hiding this comment.
For my understanding, are the pxd modules compiled (so the change in params cause a compilation error if done wrong) or are these interpreted? If the latter, I'm assuming this is abundantly tested by unittests, right?
There was a problem hiding this comment.
They are compiled. If they're not included here, we get compilation errors.
| if decryption_config is None: | ||
| c_decryption_config = CExternalDecryptionConfiguration() | ||
| else: | ||
| c_decryption_config = deref(decryption_config.unwrap_external().get()) |
There was a problem hiding this comment.
I lost a little track around here. If not can you add a comment at the if-else level on what this is doing.
If this is common pattern / boilerplate, please disregard.
There was a problem hiding this comment.
Boilerplate check that we have even an empty decryption config to work with, in case none was sent.
| assert read_data_table.num_rows == data_table.num_rows | ||
| assert read_data_table.num_columns == data_table.num_columns | ||
| assert read_data_table.schema.equals(data_table.schema) | ||
| assert read_data_table.column_names == data_table.column_names |
There was a problem hiding this comment.
Thanks very much for the thorough test.
There was a problem hiding this comment.
This is part of @cristekdatum's original test.
| const CDecryptionConfiguration& decryption_config) except +* | ||
| shared_ptr[CExternalFileDecryptionProperties] GetExternalFileDecryptionProperties( | ||
| const CKmsConnectionConfig& kms_connection_config, | ||
| const CExternalDecryptionConfiguration& decryption_config) except +* |
Adding code for the [31] and support the external_file_decryption_properties