Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,25 @@ Create / download all datasets
./bench.sh data
```

Create / download a specific dataset (TPCH)
Create / download a specific dataset (TPCH with SF=1)

```shell
./bench.sh data tpch

# or with a custom scale, e.g. SF=10
./bench.sh data tpch10
```

Data is placed in the `data` subdirectory.

## Running benchmarks

Run benchmark for TPC-H dataset
Run benchmark for TPC-H dataset (SF=1)

```shell
./bench.sh run tpch
```

or for TPC-H dataset scale 10

```shell
# or with a custom scale, e.g. SF=10
./bench.sh run tpch10
```

Expand Down Expand Up @@ -645,6 +645,9 @@ See [`sort_tpch.rs`](src/sort_tpch.rs) for more details.

```bash
./bench.sh run sort_tpch

# or with a custom scale, e.g. SF=10
./bench.sh run sort_tpch10
```

### TopK TPCH
Expand Down Expand Up @@ -747,15 +750,18 @@ Generate the SF1 parquet data with [`tpcgen-cli`](https://github.com/datafusion-

```shell
./benchmarks/bench.sh data tpcds

# or with a custom scale, e.g. SF=10
./benchmarks/bench.sh data tpcds10
```

Then run the benchmark with the following command:
Then run the benchmark with the following command (SF=1):

```shell
./benchmarks/bench.sh run tpcds
```

Alternatively benchmark the specific query
Alternatively benchmark the specific query (Q30, SF=1):

```shell
./benchmarks/bench.sh run tpcds 30
Expand Down
126 changes: 65 additions & 61 deletions benchmarks/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# Exit on error
set -e

shopt -s extglob

# https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

Expand Down Expand Up @@ -71,19 +73,15 @@ Benchmarks
all(default): Data/Run/Compare for all benchmarks

# TPC-H Benchmarks
tpch: TPCH inspired benchmark on Scale Factor (SF) 1 (~1GB), single parquet file per table, hash join
tpch_csv: TPCH inspired benchmark on Scale Factor (SF) 1 (~1GB), single csv file per table, hash join
tpch_mem: TPCH inspired benchmark on Scale Factor (SF) 1 (~1GB), query from memory
tpch10: TPCH inspired benchmark on Scale Factor (SF) 10 (~10GB), single parquet file per table, hash join
tpch_csv10: TPCH inspired benchmark on Scale Factor (SF) 10 (~10GB), single csv file per table, hash join
tpch_mem10: TPCH inspired benchmark on Scale Factor (SF) 10 (~10GB), query from memory
tpch[SF]: TPCH inspired benchmark on a custom Scale Factor (SF) (default=1 ~1GB), single parquet file per table, hash join
tpch_csv[SF]: TPCH inspired benchmark on a custom Scale Factor (SF) (default=1 ~1GB), single csv file per table, hash join
tpch_mem[SF]: TPCH inspired benchmark on a custom Scale Factor (SF) (default=1 ~1GB), query from memory

# TPC-DS Benchmarks
tpcds: TPCDS inspired benchmark on Scale Factor (SF) 1 (~1GB), single parquet file per table, hash join
tpcds[SF]: TPCDS inspired benchmark on a custom Scale Factor (SF) (default=1 ~1GB), single parquet file per table, hash join

# Extended TPC-H Benchmarks
sort_tpch: Benchmark of sorting speed for end-to-end sort queries on TPC-H dataset (SF=1)
sort_tpch10: Benchmark of sorting speed for end-to-end sort queries on TPC-H dataset (SF=10)
sort_tpch[SF]: Benchmark of sorting speed for end-to-end sort queries on TPC-H dataset (default SF=1)
topk_tpch: Benchmark of top-k (sorting with limit) queries on TPC-H dataset (SF=1)
topk_sorted_tpch: Benchmark of top-k queries on TPC-H lineitem ordered by l_orderkey (SF=1)
push_down_topk: Benchmark of ORDER BY ... LIMIT over outer joins on TPC-H dataset (SF=1) — exercises pushing TopK through a join
Expand Down Expand Up @@ -240,23 +238,20 @@ main() {
data_asof_join
# nlj uses range() function, no data generation needed
;;
tpch)
data_tpch "1" "parquet"
tpch*([0-9]))
scale=${BENCHMARK#tpch}
scale=${scale:-1}
data_tpch "$scale" "parquet"
;;
tpch_mem)
data_tpch "1" "parquet"
tpch_mem*([0-9]))
scale=${BENCHMARK#tpch_mem}
scale=${scale:-1}
data_tpch "$scale" "parquet"
;;
tpch_csv)
data_tpch "1" "csv"
;;
tpch10)
data_tpch "10" "parquet"
;;
tpch_mem10)
data_tpch "10" "parquet"
;;
tpch_csv10)
data_tpch "10" "csv"
tpch_csv*([0-9]))
scale=${BENCHMARK#tpch_csv}
scale=${scale:-1}
data_tpch "$scale" "csv"
;;
wide_schema)
data_wide_schema
Expand Down Expand Up @@ -287,8 +282,10 @@ main() {
asof_join)
data_asof_join
;;
tpcds)
data_tpcds
tpcds*([0-9]))
scale=${BENCHMARK#tpcds}
scale=${scale:-1}
data_tpcds "$scale"
;;
clickbench_1)
data_clickbench_1
Expand Down Expand Up @@ -391,13 +388,10 @@ main() {
sort_pushdown_inexact|sort_pushdown_inexact_unsorted|sort_pushdown_inexact_overlap)
data_sort_pushdown_inexact
;;
sort_tpch)
# same data as for tpch
data_tpch "1" "parquet"
;;
sort_tpch10)
# same data as for tpch10
data_tpch "10" "parquet"
sort_tpch*([0-9]))
scale=${BENCHMARK#sort_tpch}
scale=${scale:-1}
data_tpch "$scale" "parquet"
;;
topk_tpch|topk_sorted_tpch)
# same data as for tpch
Expand Down Expand Up @@ -504,23 +498,20 @@ main() {
run_dict
run_null_aware_join
;;
tpch)
run_tpch "1" "parquet"
;;
tpch_csv)
run_tpch "1" "csv"
tpch*([0-9]))
scale=${BENCHMARK#tpch}
scale=${scale:-1}
run_tpch "$scale" "parquet"
;;
tpch_mem)
run_tpch_mem "1"
tpch_mem*([0-9]))
scale=${BENCHMARK#tpch_mem}
scale=${scale:-1}
run_tpch_mem "$scale" "parquet"
;;
tpch10)
run_tpch "10" "parquet"
;;
tpch_csv10)
run_tpch "10" "csv"
;;
tpch_mem10)
run_tpch_mem "10"
tpch_csv*([0-9]))
scale=${BENCHMARK#tpch_csv}
scale=${scale:-1}
run_tpch "$scale" "csv"
;;
wide_schema)
run_wide_schema
Expand All @@ -543,8 +534,10 @@ main() {
asof_join)
run_asof_join
;;
tpcds)
run_tpcds
tpcds*([0-9]))
scale=${BENCHMARK#tpcds}
scale=${scale:-1}
run_tpcds "$scale"
;;
cancellation)
run_cancellation
Expand Down Expand Up @@ -655,11 +648,10 @@ main() {
sort_pushdown_inexact_overlap)
run_sort_pushdown_inexact_overlap
;;
sort_tpch)
run_sort_tpch "1"
;;
sort_tpch10)
run_sort_tpch "10"
sort_tpch*([0-9]))
scale=${BENCHMARK#sort_tpch}
scale=${scale:-1}
run_sort_tpch "$scale"
;;
topk_tpch)
run_topk_tpch
Expand Down Expand Up @@ -791,9 +783,15 @@ data_tpch() {
exit 1
}

# Generates TPC-DS SF1 data, one parquet file per table
# Generates TPC-DS data, one parquet file per table
# Scale factor should be passed as the first argument
data_tpcds() {
TPCDS_DIR="${DATA_DIR}/tpcds_sf1"
SCALE_FACTOR=$1
if [ -z "$SCALE_FACTOR" ] ; then
echo "Internal error: Scale factor not specified"
exit 1
fi
TPCDS_DIR="${DATA_DIR}/tpcds_sf$SCALE_FACTOR"

# Check if `web_site.parquet` exists in the TPCDS data directory to verify data presence
echo "Checking TPC-DS data directory: ${TPCDS_DIR}"
Expand All @@ -806,7 +804,7 @@ data_tpcds() {
mkdir -p "${TPCDS_DIR}"
echo "Creating TPC-DS parquet data in ${TPCDS_DIR} using tpcgen-cli..."
# Omitting --parts writes <table>.parquet directly under the output directory
tpcgen-cli tpcds parquet -s 1 --compression='ZSTD(1)' --output-dir "${TPCDS_DIR}"
tpcgen-cli tpcds parquet -s $SCALE_FACTOR --compression='ZSTD(1)' --output-dir "${TPCDS_DIR}"
fi
echo "Done."
}
Expand Down Expand Up @@ -1053,19 +1051,25 @@ run_tpch_mem() {
}

# Runs the tpcds benchmark
# Scale factor should be passed as the first argument
run_tpcds() {
TPCDS_DIR="${DATA_DIR}/tpcds_sf1"
SCALE_FACTOR=$1
if [ -z "$SCALE_FACTOR" ] ; then
echo "Internal error: Scale factor not specified"
exit 1
fi
TPCDS_DIR="${DATA_DIR}/tpcds_sf$SCALE_FACTOR"

# Check if TPCDS data directory and representative file exists
if [ ! -f "${TPCDS_DIR}/web_site.parquet" ]; then
echo "" >&2
echo "Please prepare TPC-DS data first by following instructions:" >&2
echo " ./bench.sh data tpcds" >&2
echo " ./bench.sh data tpcds$SCALE_FACTOR" >&2
echo "" >&2
exit 1
fi

RESULTS_FILE="${RESULTS_DIR}/tpcds_sf1.json"
RESULTS_FILE="${RESULTS_DIR}/tpcds_sf$SCALE_FACTOR.json"
echo "RESULTS_FILE: ${RESULTS_FILE}"
echo "Running tpcds benchmark..."

Expand Down