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

Function ReadTableManually

cpp/src/parquet/arrow/arrow_reader_writer_test.cc:2651–2670  ·  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

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
2672TEST(TestArrowReadWrite, ReadTableManually) {
2673 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