Exercise reading table manually with nested RowGroup and Column loops, i.e. for (int i = 0; i < n_row_groups; i++) for (int j = 0; j < n_cols; j++) reader->RowGroup(i)->Column(j)->Read(&chunked_array);
| 2513 | // for (int j = 0; j < n_cols; j++) |
| 2514 | // reader->RowGroup(i)->Column(j)->Read(&chunked_array); |
| 2515 | ::arrow::Result<std::shared_ptr<Table>> ReadTableManually(FileReader* reader) { |
| 2516 | std::vector<std::shared_ptr<Table>> tables; |
| 2517 | |
| 2518 | std::shared_ptr<::arrow::Schema> schema; |
| 2519 | RETURN_NOT_OK(reader->GetSchema(&schema)); |
| 2520 | |
| 2521 | int n_row_groups = reader->num_row_groups(); |
| 2522 | int n_columns = schema->num_fields(); |
| 2523 | for (int i = 0; i < n_row_groups; i++) { |
| 2524 | std::vector<std::shared_ptr<ChunkedArray>> columns{static_cast<size_t>(n_columns)}; |
| 2525 | |
| 2526 | for (int j = 0; j < n_columns; j++) { |
| 2527 | RETURN_NOT_OK(reader->RowGroup(i)->Column(j)->Read(&columns[j])); |
| 2528 | } |
| 2529 | |
| 2530 | tables.push_back(Table::Make(schema, columns)); |
| 2531 | } |
| 2532 | |
| 2533 | return ConcatenateTables(tables); |
| 2534 | } |
| 2535 | |
| 2536 | TEST(TestArrowReadWrite, ReadTableManually) { |
| 2537 | const int num_columns = 1; |
nothing calls this directly
no test coverage detected