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

Function BenchmarkReadTable

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

Source from the content-addressed store, hash-verified

284};
285
286static 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
317static void BenchmarkReadTable(::benchmark::State& state, const Table& table,
318 int64_t num_values = -1, int64_t total_bytes = -1) {

Callers 4

BenchmarkReadArrayFunction · 0.85
BM_ReadColumnFunction · 0.85

Calls 10

CreateOutputStreamFunction · 0.85
default_memory_poolFunction · 0.85
store_schemaMethod · 0.80
WriteTableFunction · 0.70
BuilderFunction · 0.50
MakeFunction · 0.50
buildMethod · 0.45
num_rowsMethod · 0.45
statusMethod · 0.45
ReadTableMethod · 0.45

Tested by

no test coverage detected