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


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

Review Comment:
   Could we add specific objects in parameters for `ParquetEncryptionConfig` 
and `ParquetDecryptionConfig`, like `pyarrow.parquet.encryption.CryptoFactory` 
or `CryptoFactory` instead of just object?



##########
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:
   ```suggestion
   
   
       cdef class ParquetDecryptionConfig(_Weakrefable):
   ```
   
   Here also.



##########
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):

Review Comment:
   ```suggestion
   
   
       cdef class ParquetEncryptionConfig(_Weakrefable):
   ```
   
   Small formatting nit as suggested by Joris.



##########
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):
+        """
+        Configuration for Parquet Decryption.
+
+        Parameters
+        ----------
+        crypto_factory : object
+            Factory for creating cryptographic instances.
+        kms_connection_config : object
+            Configuration for connecting to Key Management Service.
+        decryption_config : object
+            Configuration for decryption settings.
+
+        Raises
+        ------
+        ValueError
+            If decryption_config is None.
+        """
+        cdef:
+            shared_ptr[CParquetDecryptionConfig] c_config
+
+        # Avoid mistakingly creating attributes
+        __slots__ = ()
+
+        def __cinit__(self, object crypto_factory, object 
kms_connection_config,
+                      object decryption_config):
+
+            cdef shared_ptr[CDecryptionConfiguration] c_decryption_config
+
+            if decryption_config is None:
+                raise ValueError(
+                    "decryption_config cannot be None")
+
+            self.c_config.reset(new CParquetDecryptionConfig())
+
+            c_decryption_config = 
pyarrow_unwrap_decryptionconfig(decryption_config)
+
+            
self.c_config.get().Setup(pyarrow_unwrap_cryptofactory(crypto_factory),
+                                      pyarrow_unwrap_kmsconnectionconfig(
+                kms_connection_config),
+                c_decryption_config)
+
+        @staticmethod
+        cdef wrap(shared_ptr[CParquetDecryptionConfig] c_config):
+            cdef ParquetDecryptionConfig python_config = 
ParquetDecryptionConfig.__new__(ParquetDecryptionConfig)
+            python_config.c_config = c_config
+            return python_config
+
+        cdef shared_ptr[CParquetDecryptionConfig] unwrap(self):
+            return self.c_config

Review Comment:
   ```suggestion
               return self.c_config
   
   ```
   And here.



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