@@ -509,9 +509,9 @@ Result<std::shared_ptr<parquet::arrow::FileReader>> ParquetFileFormat::GetReader
509509 std::shared_ptr<parquet::FileMetaData> reader_metadata = reader->metadata ();
510510 auto arrow_properties =
511511 MakeArrowReaderProperties (*this , *reader_metadata, *options, *parquet_scan_options);
512- std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
513- RETURN_NOT_OK ( parquet::arrow::FileReader::Make (
514- options-> pool , std::move (reader), std::move (arrow_properties), &arrow_reader ));
512+ ARROW_ASSIGN_OR_RAISE ( auto arrow_reader,
513+ parquet::arrow::FileReader::Make (options-> pool , std::move (reader),
514+ std::move (arrow_properties)));
515515 // R build with openSUSE155 requires an explicit shared_ptr construction
516516 return std::shared_ptr<parquet::arrow::FileReader>(std::move (arrow_reader));
517517}
@@ -532,37 +532,37 @@ Future<std::shared_ptr<parquet::arrow::FileReader>> ParquetFileFormat::GetReader
532532 source.filesystem (), options->pool );
533533 auto self = checked_pointer_cast<const ParquetFileFormat>(shared_from_this ());
534534
535- return source.OpenAsync ().Then (
536- [self = self, properties = std::move (properties), source = source,
537- options = options, metadata = metadata,
538- parquet_scan_options = parquet_scan_options](
539- const std::shared_ptr<io::RandomAccessFile>& input) mutable {
540- return parquet::ParquetFileReader::OpenAsync (input, properties, metadata)
541- .Then (
542- [=](const std::unique_ptr<parquet::ParquetFileReader>& reader) mutable
543- -> Result<std::shared_ptr<parquet::arrow::FileReader>> {
544- auto arrow_properties = MakeArrowReaderProperties (
545- *self, *reader->metadata (), *options, *parquet_scan_options);
546-
547- std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
548- RETURN_NOT_OK (parquet::arrow::FileReader::Make (
535+ return source.OpenAsync ().Then ([self = self, properties = std::move (properties),
536+ source = source, options = options, metadata = metadata,
537+ parquet_scan_options = parquet_scan_options](
538+ const std::shared_ptr<io::RandomAccessFile>&
539+ input) mutable {
540+ return parquet::ParquetFileReader::OpenAsync (input, properties, metadata)
541+ .Then (
542+ [=](const std::unique_ptr<parquet::ParquetFileReader>& reader) mutable
543+ -> Result<std::shared_ptr<parquet::arrow::FileReader>> {
544+ auto arrow_properties = MakeArrowReaderProperties (
545+ *self, *reader->metadata (), *options, *parquet_scan_options);
546+
547+ ARROW_ASSIGN_OR_RAISE (
548+ auto arrow_reader,
549+ parquet::arrow::FileReader::Make (
549550 options->pool ,
550551 // TODO(ARROW-12259): workaround since we have Future<(move-only
551552 // type)> It *wouldn't* be safe to const_cast reader except that
552553 // here we know there are no other waiters on the reader.
553554 std::move (const_cast <std::unique_ptr<parquet::ParquetFileReader>&>(
554555 reader)),
555- arrow_properties, &arrow_reader));
556-
557- // R build with openSUSE155 requires an explicit shared_ptr construction
558- return std::shared_ptr<parquet::arrow::FileReader>(
559- std::move (arrow_reader));
560- },
561- [path = source.path ()](const Status& status)
562- -> Result<std::shared_ptr<parquet::arrow::FileReader>> {
563- return WrapSourceError (status, path);
564- });
565- });
556+ arrow_properties));
557+
558+ // R build with openSUSE155 requires an explicit shared_ptr construction
559+ return std::shared_ptr<parquet::arrow::FileReader>(std::move (arrow_reader));
560+ },
561+ [path = source.path ()](const Status& status)
562+ -> Result<std::shared_ptr<parquet::arrow::FileReader>> {
563+ return WrapSourceError (status, path);
564+ });
565+ });
566566}
567567
568568struct SlicingGenerator {
0 commit comments