| 724 | // |
| 725 | |
| 726 | static 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 | |
| 760 | BENCHMARK(BM_ReadIndividualRowGroups); |
| 761 |
nothing calls this directly
no test coverage detected