| 326 | }; |
| 327 | |
| 328 | static void BenchmarkReadTable(::benchmark::State& state, const Table& table, |
| 329 | std::shared_ptr<WriterProperties> properties, |
| 330 | int64_t num_values = -1, int64_t total_bytes = -1) { |
| 331 | // Make sure we roundtrip Arrow types by storing the schema |
| 332 | auto arrow_properties = ArrowWriterProperties::Builder().store_schema()->build(); |
| 333 | auto output = CreateOutputStream(); |
| 334 | EXIT_NOT_OK(WriteTable(table, ::arrow::default_memory_pool(), output, |
| 335 | /*chunk_size=*/table.num_rows(), properties, arrow_properties)); |
| 336 | PARQUET_ASSIGN_OR_THROW(auto buffer, output->Finish()); |
| 337 | |
| 338 | for (auto _ : state) { |
| 339 | auto reader = |
| 340 | ParquetFileReader::Open(std::make_shared<::arrow::io::BufferReader>(buffer)); |
| 341 | auto arrow_reader_result = |
| 342 | FileReader::Make(::arrow::default_memory_pool(), std::move(reader)); |
| 343 | EXIT_NOT_OK(arrow_reader_result.status()); |
| 344 | auto arrow_reader = std::move(*arrow_reader_result); |
| 345 | |
| 346 | auto table_result = arrow_reader->ReadTable(); |
| 347 | EXIT_NOT_OK(table_result.status()); |
| 348 | } |
| 349 | |
| 350 | if (num_values == -1) { |
| 351 | num_values = table.num_rows(); |
| 352 | } |
| 353 | state.SetItemsProcessed(num_values * state.iterations()); |
| 354 | if (total_bytes != -1) { |
| 355 | state.SetBytesProcessed(total_bytes * state.iterations()); |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | static void BenchmarkReadTable(::benchmark::State& state, const Table& table, |
| 360 | int64_t num_values = -1, int64_t total_bytes = -1) { |
no test coverage detected