diff --git a/cpp/src/parquet/arrow/reader.cc b/cpp/src/parquet/arrow/reader.cc index 212cfb669270f..53197e46f4f75 100644 --- a/cpp/src/parquet/arrow/reader.cc +++ b/cpp/src/parquet/arrow/reader.cc @@ -1315,20 +1315,32 @@ Status FileReader::GetRecordBatchReader(const std::vector& row_group_indice return Status::OK(); } -Result> Make(::arrow::MemoryPool* pool, - std::unique_ptr reader, +Status FileReader::Make(MemoryPool* pool, std::unique_ptr reader, const ArrowReaderProperties& properties, std::unique_ptr* out) { *out = std::make_unique(pool, std::move(reader), properties); return static_cast(out->get())->Init(); } -Result> Make(::arrow::MemoryPool* pool, - std::unique_ptr reader, +Result> FileReader::Make( + MemoryPool* pool, std::unique_ptr reader, + const ArrowReaderProperties& properties) { + auto file_reader = + std::make_unique(pool, std::move(reader), properties); + RETURN_NOT_OK(file_reader->Init()); + return file_reader; +} + +Status FileReader::Make(MemoryPool* pool, std::unique_ptr reader, std::unique_ptr* out) { return Make(pool, std::move(reader), default_arrow_reader_properties(), out); } +Result> FileReader::Make( + MemoryPool* pool, std::unique_ptr reader) { + return Make(pool, std::move(reader), default_arrow_reader_properties()); +} + 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 c0300f51d87b9..6fc8828c37616 100644 --- a/cpp/src/parquet/arrow/reader.h +++ b/cpp/src/parquet/arrow/reader.h @@ -118,27 +118,28 @@ class PARQUET_EXPORT FileReader { // Factory function to create a FileReader from a ParquetFileReader and properties. // \deprecated Deprecated in 19.0.0. Use arrow::Result version instead. ARROW_DEPRECATED("Deprecated in 19.0.0. Use arrow::Result version instead.") - static ::arrow::Status Make( - ::arrow::MemoryPool* pool, std::unique_ptr reader, - const ArrowReaderProperties& properties, std::unique_ptr* out); - - /// Factory function to create a FileReader from a ParquetFileReader and properties + static ::arrow::Status Make(::arrow::MemoryPool* pool, + std::unique_ptr reader, + const ArrowReaderProperties& properties, + std::unique_ptr* out); + + // Factory function to create a FileReader from a ParquetFileReader and properties + // Returns an arrow::Result containing a unique pointer to the FileReader. static ::arrow::Result> Make( ::arrow::MemoryPool* pool, std::unique_ptr reader, - const ArrowReaderProperties& properties, std::unique_ptr* out); + const ArrowReaderProperties& properties); // Factory function to create a FileReader from a ParquetFileReader. // \deprecated Deprecated in 19.0.0. Use arrow::Result version instead. ARROW_DEPRECATED("Deprecated in 19.0.0. Use arrow::Result version instead.") - static ::arrow::Result> Make( - ::arrow::MemoryPool* pool, std::unique_ptr reader, - std::unique_ptr* out); + static ::arrow::Status Make(::arrow::MemoryPool* pool, + std::unique_ptr reader, + std::unique_ptr* out); // Factory function to create a FileReader from a ParquetFileReader. // Returns an arrow::Result containing a unique pointer to the FileReader. static ::arrow::Result> Make( - ::arrow::MemoryPool* pool, std::unique_ptr reader, - std::unique_ptr* out); + ::arrow::MemoryPool* pool, std::unique_ptr 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