You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/22 09:55:50 UTC

[GitHub] [arrow] pitrou commented on a change in pull request #10566: ARROW-13135: [C++] Fix Status propagation from Parquet exception

pitrou commented on a change in pull request #10566:
URL: https://github.com/apache/arrow/pull/10566#discussion_r656064551



##########
File path: cpp/src/arrow/dataset/file_parquet.cc
##########
@@ -307,14 +321,17 @@ Result<std::unique_ptr<parquet::arrow::FileReader>> ParquetFileFormat::GetReader
   auto properties = MakeReaderProperties(*this, parquet_scan_options.get(), pool);
 
   ARROW_ASSIGN_OR_RAISE(auto input, source.Open());
-  std::unique_ptr<parquet::ParquetFileReader> reader;
-  try {
-    reader = parquet::ParquetFileReader::Open(std::move(input), std::move(properties));
-  } catch (const ::parquet::ParquetException& e) {
-    return Status::IOError("Could not open parquet input source '", source.path(),
-                           "': ", e.what());
-  }
 
+  auto maybe_reader = [&]() -> Result<std::unique_ptr<parquet::ParquetFileReader>> {

Review comment:
       Hmm, I'm a bit lukewarm. Other similar functionality is already managed as macros (`ARROW_RETURN_NOT_OK`, `RETURN_IF_PYERROR`...). It seems like it would introduce a gratuitous variation. Also, given the size of the C++ metaprogramming alternative, this is possibly a reasonable use case for a macro.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org