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

Function BM_ReadIndividualRowGroups

cpp/src/parquet/arrow/reader_writer_benchmark.cc:726–758  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724//
725
726static void BM_ReadIndividualRowGroups(::benchmark::State& state) {
727 std::vector<int64_t> values(BENCHMARK_SIZE, 128);
728 std::shared_ptr<Table> table = TableFromVector<Int64Type>(values, true);
729 auto output = CreateOutputStream();
730 // This writes 10 RowGroups
731 EXIT_NOT_OK(
732 WriteTable(*table, ::arrow::default_memory_pool(), output, BENCHMARK_SIZE / 10));
733
734 PARQUET_ASSIGN_OR_THROW(auto buffer, output->Finish());
735
736 while (state.KeepRunning()) {
737 auto reader =
738 ParquetFileReader::Open(std::make_shared<::arrow::io::BufferReader>(buffer));
739 auto arrow_reader_result =
740 FileReader::Make(::arrow::default_memory_pool(), std::move(reader));
741 EXIT_NOT_OK(arrow_reader_result.status());
742 auto arrow_reader = std::move(*arrow_reader_result);
743
744 std::vector<std::shared_ptr<Table>> tables;
745 for (int i = 0; i < arrow_reader->num_row_groups(); i++) {
746 // Only read the even numbered RowGroups
747 if ((i % 2) == 0) {
748 std::shared_ptr<Table> table;
749 EXIT_NOT_OK(arrow_reader->RowGroup(i)->ReadTable(&table));
750 tables.push_back(table);
751 }
752 }
753
754 std::shared_ptr<Table> final_table;
755 PARQUET_ASSIGN_OR_THROW(final_table, ConcatenateTables(tables));
756 }
757 SetBytesProcessed<Int64Type>(state);
758}
759
760BENCHMARK(BM_ReadIndividualRowGroups);
761

Callers

nothing calls this directly

Calls 10

CreateOutputStreamFunction · 0.85
default_memory_poolFunction · 0.85
ConcatenateTablesFunction · 0.85
push_backMethod · 0.80
WriteTableFunction · 0.70
MakeFunction · 0.50
statusMethod · 0.45
num_row_groupsMethod · 0.45
ReadTableMethod · 0.45
RowGroupMethod · 0.45

Tested by

no test coverage detected