| 284 | }; |
| 285 | |
| 286 | static void BenchmarkReadTable(::benchmark::State& state, const Table& table, |
| 287 | std::shared_ptr<WriterProperties> properties, |
| 288 | int64_t num_values = -1, int64_t total_bytes = -1) { |
| 289 | // Make sure we roundtrip Arrow types by storing the schema |
| 290 | auto arrow_properties = ArrowWriterProperties::Builder().store_schema()->build(); |
| 291 | auto output = CreateOutputStream(); |
| 292 | EXIT_NOT_OK(WriteTable(table, ::arrow::default_memory_pool(), output, |
| 293 | /*chunk_size=*/table.num_rows(), properties, arrow_properties)); |
| 294 | PARQUET_ASSIGN_OR_THROW(auto buffer, output->Finish()); |
| 295 | |
| 296 | for (auto _ : state) { |
| 297 | auto reader = |
| 298 | ParquetFileReader::Open(std::make_shared<::arrow::io::BufferReader>(buffer)); |
| 299 | auto arrow_reader_result = |
| 300 | FileReader::Make(::arrow::default_memory_pool(), std::move(reader)); |
| 301 | EXIT_NOT_OK(arrow_reader_result.status()); |
| 302 | auto arrow_reader = std::move(*arrow_reader_result); |
| 303 | |
| 304 | auto table_result = arrow_reader->ReadTable(); |
| 305 | EXIT_NOT_OK(table_result.status()); |
| 306 | } |
| 307 | |
| 308 | if (num_values == -1) { |
| 309 | num_values = table.num_rows(); |
| 310 | } |
| 311 | state.SetItemsProcessed(num_values * state.iterations()); |
| 312 | if (total_bytes != -1) { |
| 313 | state.SetBytesProcessed(total_bytes * state.iterations()); |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | static void BenchmarkReadTable(::benchmark::State& state, const Table& table, |
| 318 | int64_t num_values = -1, int64_t total_bytes = -1) { |
no test coverage detected