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

Function BenchmarkReadTable

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

Source from the content-addressed store, hash-verified

326};
327
328static 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
359static void BenchmarkReadTable(::benchmark::State& state, const Table& table,
360 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