pitrou commented on code in PR #47087:
URL: https://github.com/apache/arrow/pull/47087#discussion_r2314222537


##########
python/pyarrow/_parquet.pyx:
##########
@@ -2408,3 +2411,77 @@ cdef class ParquetWriter(_Weakrefable):
             return result
         raise RuntimeError(
             'file metadata is only available after writer close')
+
+    @property
+    def properties(self):
+        cdef const WriterProperties* props_ptr
+        cdef WriterPropertiesWrapper result
+
+        props_ptr = &self.writer.get().properties()
+        result = WriterPropertiesWrapper.__new__(WriterPropertiesWrapper)
+        result.init(props_ptr)
+        return result
+
+    @property
+    def arrow_properties(self):
+        cdef ArrowWriterPropertiesWrapper result
+
+        result = 
ArrowWriterPropertiesWrapper.__new__(ArrowWriterPropertiesWrapper)
+        result.init(self._arrow_properties)
+        return result
+
+
+cdef class WriterPropertiesWrapper(_Weakrefable):
+    cdef:
+        const WriterProperties* props
+
+    def __cinit__(self):
+        self.props = NULL
+
+    cdef init(self, const WriterProperties* props):
+        self.props = props
+
+    @property
+    def version(self):
+        return self.props.version()
+
+    @property
+    def created_by(self):
+        return frombytes(self.props.created_by())
+
+    @property
+    def dictionary_enabled(self):
+        return self.props.default_column_properties().dictionary_enabled()
+
+    @property
+    def statistics_enabled(self):
+        return self.props.default_column_properties().statistics_enabled()
+
+
+cdef class ArrowWriterPropertiesWrapper(_Weakrefable):
+    cdef:
+        shared_ptr[ArrowWriterProperties] props
+
+    def __cinit__(self):
+        self.props.reset()
+
+    cdef init(self, shared_ptr[ArrowWriterProperties] props):
+        self.props = props

Review Comment:
   If we're getting a const-ref from the C++ APIs, we should certainly not turn 
it into a `shared_ptr`. You should probably let the C++ APIs return a 
`shared_ptr`?



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