Apache DataFusion SQL Query Engine
ARROW-9784: [Rust][DataFusion] Make running TPCH benchmark repeatable
alambca6c54f59afa
diff --git a/rust/benchmarks/README.md b/rust/benchmarks/README.mdindex 468341dccc..3d6eb305ff 100644--- a/rust/benchmarks/README.md+++ b/rust/benchmarks/README.md@@ -23,18 +23,32 @@ This crate contains benchmarks based on popular public data sets and open sourcerun real-world benchmarks to help with performance and scalability testing and for comparing performance with other Arrowimplementations as well as other query engines.-Currently, only DataFusion benchmarks exist, but the plan is to add benchmarks for the arrow, flight, and parquet-crates as well.+Currently, only DataFusion benchmarks exist, but the plan is to add benchmarks for the arrow, flight, and parquet+crates as well.## Benchmark derived from TPC-H-These benchmarks are derived from the [TPC-H](http://www.tpc.org/tpch/) benchmark. Data for this benchmark can be-generated using [tpch-dbgen](https://github.com/databricks/tpch-dbgen).+These benchmarks are derived from the [TPC-H](http://www.tpc.org/tpch/) benchmark.++Data for this benchmark can be generated using the+[tpch-dbgen](https://github.com/databricks/tpch-dbgen) tool with a+command such as the following (`-s 1` means use Scale Factor 1 or ~1 GB of+data, replace the 1 to change datasize).++```+cd /mnt/tpch-dbgen+dbgen -vf -s 1+```++The benchmark can then be run (assuming the data created from `dbgen` is in `/mnt/tpch-dbgen`) with a command such as:```bash-cargo run --release --bin tpch -- --iterations 3 --path /mnt/tpch/csv --format csv --query 1 --batch-size 4096+cargo run --release --bin tpch -- --iterations 3 --path /mnt/tpch-dbgen --format tbl --query 1 --batch-size 4096```+The benchmark program also supports csv and parquet file formats++## NYC Taxi BenchmarkThese benchmarks are based on the [New York Taxi and Limousine Commission](https://www1.nyc.gov/site/tlc/about/tlc-trip-record-data.page) data set.@@ -51,4 +65,4 @@ Executing 'fare_amt_by_passenger'Query 'fare_amt_by_passenger' iteration 0 took 7138 msQuery 'fare_amt_by_passenger' iteration 1 took 7599 msQuery 'fare_amt_by_passenger' iteration 2 took 7969 ms-```\ No newline at end of file+```diff --git a/rust/benchmarks/src/bin/tpch.rs b/rust/benchmarks/src/bin/tpch.rsindex e556dc57bf..49bcf32bbc 100644--- a/rust/benchmarks/src/bin/tpch.rs+++ b/rust/benchmarks/src/bin/tpch.rs@@ -73,6 +73,16 @@ fn main() -> Result<()> {let path = opt.path.to_str().unwrap();match opt.file_format.as_str() {+ // dbgen creates .tbl ('|' delimited) files+ "tbl" => {+ let path = format!("{}/lineitem.tbl", path);+ let schema = lineitem_schema();+ let options = CsvReadOptions::new()+ .schema(&schema)+ .delimiter(b'|')+ .file_extension(".tbl");+ ctx.register_csv("lineitem", &path, options)?+ }"csv" => {let path = format!("{}/lineitem", path);let schema = lineitem_schema();