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);
| 2649 | // for (int j = 0; j < n_cols; j++) |
| 2650 | // reader->RowGroup(i)->Column(j)->Read(&chunked_array); |
| 2651 | ::arrow::Result<std::shared_ptr<Table>> ReadTableManually(FileReader* reader) { |
| 2652 | std::vector<std::shared_ptr<Table>> tables; |
| 2653 | |
| 2654 | std::shared_ptr<::arrow::Schema> schema; |
| 2655 | RETURN_NOT_OK(reader->GetSchema(&schema)); |
| 2656 | |
| 2657 | int n_row_groups = reader->num_row_groups(); |
| 2658 | int n_columns = schema->num_fields(); |
| 2659 | for (int i = 0; i < n_row_groups; i++) { |
| 2660 | std::vector<std::shared_ptr<ChunkedArray>> columns{static_cast<size_t>(n_columns)}; |
| 2661 | |
| 2662 | for (int j = 0; j < n_columns; j++) { |
| 2663 | RETURN_NOT_OK(reader->RowGroup(i)->Column(j)->Read(&columns[j])); |
| 2664 | } |
| 2665 | |
| 2666 | tables.push_back(Table::Make(schema, columns)); |
| 2667 | } |
| 2668 | |
| 2669 | return ConcatenateTables(tables); |
| 2670 | } |
| 2671 | |
| 2672 | TEST(TestArrowReadWrite, ReadTableManually) { |
| 2673 | const int num_columns = 1; |
nothing calls this directly
no test coverage detected