Omega359 commented on code in PR #21707:
URL: https://github.com/apache/datafusion/pull/21707#discussion_r3126240296


##########
benchmarks/sql_benchmarks/README.md:
##########
@@ -0,0 +1,355 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# SQL Benchmarks
+
+This directory contains a collection of benchmarks each driven by a simple 
'.benchmark' text file and sql queries
+that exercise the DataFusion execution engine against a variety of benchmark 
suites. The sql benchmark framework
+is intentionally simple so that new benchmarks and queries can be added 
without touching the core engine.
+
+The sql benchmarks are organized in sub‑directories that correspond to the 
benchmark suites that are commonly used
+in the community:
+
+| Benchmark Suite       | Description                                          
              |
+|-----------------------|--------------------------------------------------------------------|
+| `clickbench`          | ClickBench benchmark                                 
              |
+| `clickbench extended` | 12 additional, more complex queries against the 
Clickbench dataset |
+| `clickbench_sorted`   | ClickBench benchmark using a pre-sorted hits file.   
              |
+| `h2o`                 | The `h2o` benchmark                                  
              |
+| `hj`                  | Hash join benchmark                                  
              |
+| `imdb`                | IMDb benchmark                                       
              |
+| `nlj`                 | Nested‑loop join benchmark                           
              |
+| `smj`                 | Sort‑merge join benchmark                            
              |
+| `sort tpch`           | Sorting benchmarks against the TPC-H lineitem table  
              |
+| `taxi`                | NYC taxi dataset benchmark                           
              |
+| `tpcds`               | TPC‑DS queries                                       
              |
+| `tpch`                | TPC‑H queries                                        
              |
+
+## How it works
+
+SQL benchmarks are run via cargo's bench command using 
[criterion](https://docs.rs/criterion/latest/criterion/)
+for running and gathering statistics of each sql being benchmarked. For 
simplicity the benchmarks/bench.sh can
+be used to execute the supported benchmarks.
+
+Each individual benchmark is represented by a `<name>.benchmark` file that 
contains a number of directives instructing
+the tool on how to load data, run initializations, run assertions, run the 
benchmark, optionally persist and
+validate results, and finally run any cleanup if required.
+
+Variables are supported in two forms:
+
+* string substitution based on environment variables (with default values if 
unset): \${ENV_VAR} and
+  \${ENV_VAR:-default}.
+* if / else based on whether an environment variable is true or not
+  (\${ENV_VAR:-default|true value|false value}). In this form only the value 
`true` (case-insensitive) selects the
+  true branch; any other set value selects the false branch. If ENV_VAR is 
unset, `default` is used to select the
+  branch.
+
+Comments in files are supported with lines starting with # or --.
+
+Many if not most of the benchmarks are set up using templates to reduce 
duplication across the .benchmark files. For
+example here is one of the benchmark files for the h2o benchmark suite:
+
+```
+subgroup groupby

Review Comment:
   Single file - sure, very possible. I'm not against it but it does introduce 
a fair bit of duplication and thus the possibility of copy/paste errors if/when 
benchmarks are updated.  If others feel strongly about it I can make that 
change for the tpch benchmark in this PR easily enough.
   
   I think I'd like to push the group/subgroup as nested directories feature to 
a follow on PR. I can do it here but it's a bit of churn for those who have 
already reviewed the code.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to