HuaHuaY commented on code in PR #47775:
URL: https://github.com/apache/arrow/pull/47775#discussion_r2425301750


##########
cpp/src/parquet/properties.h:
##########
@@ -1409,4 +1409,74 @@ struct ArrowWriteContext {
 PARQUET_EXPORT
 std::shared_ptr<ArrowWriterProperties> default_arrow_writer_properties();
 
+class PARQUET_EXPORT RewriterProperties {
+ public:
+  class Builder {
+   public:
+    Builder()
+        : pool_(::arrow::default_memory_pool()),
+          writer_properties_(default_writer_properties()),
+          reader_properties_(default_reader_properties()) {}
+
+    explicit Builder(const RewriterProperties& properties)
+        : pool_(properties.memory_pool()),
+          writer_properties_(properties.writer_properties()),
+          reader_properties_(properties.reader_properties()) {}
+
+    virtual ~Builder() = default;
+
+    /// Specify the memory pool for the rewriter. Default default_memory_pool.
+    Builder* memory_pool(MemoryPool* pool) {
+      pool_ = pool;
+      return this;
+    }
+
+    /// Set the writer properties.
+    Builder* writer_properties(std::shared_ptr<WriterProperties> properties) {
+      writer_properties_ = std::move(properties);
+      return this;
+    }
+
+    /// Set the reader properties.
+    Builder* reader_properties(ReaderProperties properties) {
+      reader_properties_ = std::move(properties);
+      return this;
+    }
+
+    /// Build the RewriterProperties with the builder parameters.
+    std::shared_ptr<RewriterProperties> build() {
+      return std::shared_ptr<RewriterProperties>(
+          new RewriterProperties(pool_, writer_properties_, 
reader_properties_));
+    }
+
+   private:
+    MemoryPool* pool_;
+    std::shared_ptr<WriterProperties> writer_properties_;
+    ReaderProperties reader_properties_;

Review Comment:
   It seems that `WriterProperties` is always useed with `shared_ptr` and 
`ReaderProperties` is always used directly. I don't know the reason too. I 
follow the implementation of `WriterProperties`.
   
   ```cpp
   PARQUET_EXPORT const std::shared_ptr<WriterProperties>& 
default_writer_properties();
   
   PARQUET_EXPORT
   std::shared_ptr<ArrowWriterProperties> default_arrow_writer_properties();
   
   ReaderProperties PARQUET_EXPORT default_reader_properties();
   
   PARQUET_EXPORT
   ArrowReaderProperties default_arrow_reader_properties();
   ```



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