bkietz commented on a change in pull request #8305:
URL: https://github.com/apache/arrow/pull/8305#discussion_r501157390



##########
File path: python/pyarrow/_dataset.pyx
##########
@@ -1054,18 +1095,173 @@ cdef class ParquetReadOptions(_Weakrefable):
             return False
 
 
+cdef class ParquetFileWriteOptions(FileWriteOptions):
+
+    cdef:
+        CParquetFileWriteOptions* parquet_options
+        object _properties
+
+    def update(self, **kwargs):
+        cdef CParquetFileWriteOptions* opts = self.parquet_options
+
+        arrow_fields = {
+            "use_deprecated_int96_timestamps",
+            "coerce_timestamps",
+            "allow_truncated_timestamps",
+        }
+
+        update = False
+        update_arrow = False
+        for name, value in kwargs.items():
+            assert name in self._properties
+            self._properties[name] = value
+            if name in arrow_fields:
+                update_arrow = True
+            else:
+                update = True
+
+        if update:
+            opts.writer_properties = _create_writer_properties(
+                use_dictionary=self.use_dictionary,
+                compression=self.compression,
+                version=self.version,
+                write_statistics=self.write_statistics,
+                data_page_size=self.data_page_size,
+                compression_level=self.compression_level,
+                use_byte_stream_split=self.use_byte_stream_split,
+                data_page_version=self.data_page_version,
+            )
+
+        if update_arrow:
+            opts.arrow_writer_properties = _create_arrow_writer_properties(
+                use_deprecated_int96_timestamps=(
+                    self.use_deprecated_int96_timestamps
+                ),
+                coerce_timestamps=self.coerce_timestamps,
+                allow_truncated_timestamps=self.allow_truncated_timestamps,
+                writer_engine_version=self.writer_engine_version,
+            )
+
+    @property
+    def use_dictionary(self):
+        return self._properties['use_dictionary']
+
+    @use_dictionary.setter
+    def use_dictionary(self, use_dictionary):
+        self.update(use_dictionary=use_dictionary)

Review comment:
       I'll remove the getters and setters.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to