| 1371 | |
| 1372 | template <typename Rectangle> |
| 1373 | cpp11::writable::list to_data_frame(const std::shared_ptr<Rectangle>& data, |
| 1374 | bool use_threads) { |
| 1375 | int64_t nc = data->num_columns(); |
| 1376 | int64_t nr = data->num_rows(); |
| 1377 | cpp11::writable::strings names(nc); |
| 1378 | |
| 1379 | arrow::r::RTasks tasks(use_threads); |
| 1380 | |
| 1381 | cpp11::writable::list tbl(nc); |
| 1382 | |
| 1383 | for (int i = 0; i < nc; i++) { |
| 1384 | names[i] = data->schema()->field(i)->name(); |
| 1385 | tbl[i] = Converter::LazyConvert(to_chunks(data->column(i)), tasks); |
| 1386 | } |
| 1387 | |
| 1388 | StopIfNotOk(tasks.Finish()); |
| 1389 | |
| 1390 | tbl.attr(R_NamesSymbol) = names; |
| 1391 | tbl.attr(R_ClassSymbol) = arrow::r::data::classes_tbl_df; |
| 1392 | tbl.attr(R_RowNamesSymbol) = arrow::r::short_row_names(static_cast<int>(nr)); |
| 1393 | |
| 1394 | return tbl; |
| 1395 | } |
| 1396 | |
| 1397 | } // namespace r |
| 1398 | } // namespace arrow |
no test coverage detected