tolleybot commented on code in PR #34616:
URL: https://github.com/apache/arrow/pull/34616#discussion_r1317575057


##########
python/pyarrow/_dataset_parquet.pyx:
##########
@@ -693,6 +825,10 @@ cdef class ParquetFragmentScanOptions(FragmentScanOptions):
         if thrift_container_size_limit is not None:
             self.thrift_container_size_limit = thrift_container_size_limit
 
+        IF PARQUET_ENCRYPTION_ENABLED:

Review Comment:
   I enhanced the handling of the decryption_config parameter. Previously, if 
PARQUET_ENCRYPTION_ENABLED was not set, the decryption_config parameter might 
have been silently ignored. To address this, I added explicit checks: now, if 
PARQUET_ENCRYPTION_ENABLED is False and a decryption_config is provided, an 
exception is raised to notify the user that encryption is not enabled. This 
ensures that users are made aware if they provide a decryption configuration 
when encryption support is not active, preventing potential silent failures or 
unexpected behaviors



##########
python/pyarrow/_dataset_parquet.pyx:
##########
@@ -56,9 +62,113 @@ from pyarrow._parquet cimport (
 
 cdef Expression _true = Expression._scalar(True)
 
-
 ctypedef CParquetFileWriter* _CParquetFileWriterPtr
 
+IF PARQUET_ENCRYPTION_ENABLED:
+
+    from pyarrow._parquet_encryption cimport *
+
+    cdef class ParquetEncryptionConfig(_Weakrefable):
+        """
+        Configuration for Parquet Encryption.
+
+        Parameters
+        ----------
+        crypto_factory : object
+            Factory for creating cryptographic instances.
+        kms_connection_config : object
+            Configuration for connecting to Key Management Service.
+        encryption_config : object
+            Configuration for encryption settings.
+
+        Raises
+        ------
+        ValueError
+            If encryption_config is None.
+        """
+        cdef:
+            shared_ptr[CParquetEncryptionConfig] c_config
+
+        # Avoid mistakenly creating attributes
+        __slots__ = ()
+
+        def __cinit__(self, object crypto_factory, object 
kms_connection_config,
+                      object encryption_config):
+
+            cdef shared_ptr[CEncryptionConfiguration] c_encryption_config
+
+            if encryption_config is None:
+                raise ValueError(
+                    "encryption_config cannot be None")
+
+            self.c_config.reset(new CParquetEncryptionConfig())
+
+            c_encryption_config = 
pyarrow_unwrap_encryptionconfig(encryption_config)
+
+            
self.c_config.get().Setup(pyarrow_unwrap_cryptofactory(crypto_factory),
+                                      pyarrow_unwrap_kmsconnectionconfig(
+                kms_connection_config),
+                c_encryption_config)
+
+        @staticmethod
+        cdef wrap(shared_ptr[CParquetEncryptionConfig] c_config):
+            cdef ParquetEncryptionConfig python_config = 
ParquetEncryptionConfig.__new__(ParquetEncryptionConfig)
+            python_config.c_config = c_config
+            return python_config
+
+        cdef shared_ptr[CParquetEncryptionConfig] unwrap(self):
+            return self.c_config
+
+    cdef class ParquetDecryptionConfig(_Weakrefable):
+        """

Review Comment:
   Done



##########
python/pyarrow/_dataset_parquet.pyx:
##########
@@ -56,9 +62,113 @@ from pyarrow._parquet cimport (
 
 cdef Expression _true = Expression._scalar(True)
 
-
 ctypedef CParquetFileWriter* _CParquetFileWriterPtr
 
+IF PARQUET_ENCRYPTION_ENABLED:
+
+    from pyarrow._parquet_encryption cimport *
+
+    cdef class ParquetEncryptionConfig(_Weakrefable):
+        """
+        Configuration for Parquet Encryption.
+
+        Parameters
+        ----------
+        crypto_factory : object

Review Comment:
   Done



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