MCPcopy Create free account
hub / github.com/apache/arrow / ReadTableManually

Function ReadTableManually

cpp/src/parquet/arrow/arrow_reader_writer_test.cc:2515–2534  ·  view source on GitHub ↗

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);

Source from the content-addressed store, hash-verified

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
2536TEST(TestArrowReadWrite, ReadTableManually) {
2537 const int num_columns = 1;

Callers

nothing calls this directly

Calls 9

ConcatenateTablesFunction · 0.85
push_backMethod · 0.80
MakeFunction · 0.50
GetSchemaMethod · 0.45
num_row_groupsMethod · 0.45
num_fieldsMethod · 0.45
ReadMethod · 0.45
ColumnMethod · 0.45
RowGroupMethod · 0.45

Tested by

no test coverage detected