[[arrow::export]]
| 49 | |
| 50 | // [[arrow::export]] |
| 51 | std::shared_ptr<arrow::Table> ipc___feather___Reader__Read( |
| 52 | const std::shared_ptr<arrow::ipc::feather::Reader>& reader, cpp11::sexp columns) { |
| 53 | bool use_names = columns != R_NilValue; |
| 54 | std::vector<std::string> names; |
| 55 | if (use_names) { |
| 56 | cpp11::strings columns_chr(columns); |
| 57 | names.reserve(columns_chr.size()); |
| 58 | for (const auto& name : columns_chr) { |
| 59 | names.push_back(name); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | auto result = RunWithCapturedRIfPossible<std::shared_ptr<arrow::Table>>([&]() { |
| 64 | std::shared_ptr<arrow::Table> table; |
| 65 | arrow::Status read_result; |
| 66 | if (use_names) { |
| 67 | read_result = reader->Read(names, &table); |
| 68 | } else { |
| 69 | read_result = reader->Read(&table); |
| 70 | } |
| 71 | |
| 72 | if (read_result.ok()) { |
| 73 | return arrow::Result<std::shared_ptr<arrow::Table>>(table); |
| 74 | } else { |
| 75 | return arrow::Result<std::shared_ptr<arrow::Table>>(read_result); |
| 76 | } |
| 77 | }); |
| 78 | |
| 79 | return ValueOrStop(result); |
| 80 | } |
| 81 | |
| 82 | // [[arrow::export]] |
| 83 | std::shared_ptr<arrow::ipc::feather::Reader> ipc___feather___Reader__Open( |
no test coverage detected