hiroyuki-sato commented on issue #44810:
URL: https://github.com/apache/arrow/issues/44810#issuecomment-3585598638
I wrote the code with the help of @kou 's advice. Where should I write the
tests?
```diff
diff --git a/cpp/src/parquet/arrow/reader.cc
b/cpp/src/parquet/arrow/reader.cc
index c32e588688..b067e52b6f 100644
--- a/cpp/src/parquet/arrow/reader.cc
+++ b/cpp/src/parquet/arrow/reader.cc
@@ -1353,6 +1353,23 @@ Status FileReader::Make(::arrow::MemoryPool* pool,
return Make(pool, std::move(reader), default_arrow_reader_properties(),
out);
}
+Result<std::unique_ptr<FileReader>> FileReader::Make(
+ ::arrow::MemoryPool* pool, std::unique_ptr<ParquetFileReader>
parquet_reader,
+ const ArrowReaderProperties& properties) {
+ std::unique_ptr<FileReader> reader =
+ std::make_unique<FileReaderImpl>(pool, std::move(parquet_reader),
properties);
+ RETURN_NOT_OK(static_cast<FileReaderImpl*>(reader.get())->Init());
+ return reader;
+}
+
+Result<std::unique_ptr<FileReader>> FileReader::Make(
+ ::arrow::MemoryPool* pool, std::unique_ptr<ParquetFileReader>
parquet_reader) {
+ std::unique_ptr<FileReader> reader = std::make_unique<FileReaderImpl>(
+ pool, std::move(parquet_reader), default_arrow_reader_properties());
+ RETURN_NOT_OK(static_cast<FileReaderImpl*>(reader.get())->Init());
+ return reader;
+}
+
FileReaderBuilder::FileReaderBuilder()
: pool_(::arrow::default_memory_pool()),
properties_(default_arrow_reader_properties()) {}
diff --git a/cpp/src/parquet/arrow/reader.h b/cpp/src/parquet/arrow/reader.h
index 9753fe47ba..b4a13fd3b3 100644
--- a/cpp/src/parquet/arrow/reader.h
+++ b/cpp/src/parquet/arrow/reader.h
@@ -126,6 +126,14 @@ class PARQUET_EXPORT FileReader {
std::unique_ptr<ParquetFileReader> reader,
std::unique_ptr<FileReader>* out);
+ /// Factory function to create a FileReader from a ParquetFileReader and
properties
+ static ::arrow::Result<std::unique_ptr<FileReader>> Make(
+ ::arrow::MemoryPool* pool, std::unique_ptr<ParquetFileReader> reader,
+ const ArrowReaderProperties& properties);
+
+ /// Factory function to create a FileReader from a ParquetFileReader
+ static ::arrow::Result<std::unique_ptr<FileReader>> Make(
+ ::arrow::MemoryPool* pool, std::unique_ptr<ParquetFileReader> reader);
// Since the distribution of columns amongst a Parquet file's row groups
may
// be uneven (the number of values in each column chunk can be
different), we
// provide a column-oriented read interface. The ColumnReader hides the
```
--
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]