|
1 | | -#!/bin/bash |
| 1 | +#!/usr/bin/env bash |
2 | 2 |
|
3 | | -# Install |
| 3 | +set -e |
4 | 4 |
|
5 | | -sudo apt-get install -y unzip |
6 | | -curl https://glaredb.com/install.sh | sh |
| 5 | +repo_root=$(git rev-parse --show-toplevel) |
| 6 | +script_dir=$(dirname "$0") |
7 | 7 |
|
8 | | -wget https://clickhouse-public-datasets.s3.eu-central-1.amazonaws.com/hits_compatible/athena/hits.parquet |
| 8 | +if [[ "$(basename "$repo_root")" == "glaredb" ]]; then |
| 9 | + # Inside glaredb repo, build from source. |
| 10 | + cargo build --release --bin glaredb |
| 11 | + cp "${repo_root}/target/release/glaredb" "${script_dir}/glaredb" |
| 12 | +else |
| 13 | + # Not in glaredb repo, use prebuilt binary. |
| 14 | + export GLAREDB_INSTALL_DIR="${script_dir}" |
| 15 | + export GLAREDB_VERSION="v25.5.2" |
| 16 | + curl -fsSL https://glaredb.com/install.sh | sh |
| 17 | +fi |
9 | 18 |
|
10 | | -cat queries.sql | while read -r query |
11 | | -do |
12 | | - sync |
13 | | - echo 3 | sudo tee /proc/sys/vm/drop_caches |
| 19 | +# Get the data. |
| 20 | +mkdir -p "${script_dir}/data" |
| 21 | +pushd "${script_dir}/data" |
14 | 22 |
|
15 | | - for i in $(seq 1 3); do |
16 | | - ./glaredb --timing --query "${query}" |
17 | | - done; |
18 | | -done 2>&1 | tee log.txt |
| 23 | +mode="${1:-single}" # Default to 'single' if no arg given. |
| 24 | +case "${mode}" in |
| 25 | + single) |
| 26 | + wget --continue https://clickhouse-public-datasets.s3.eu-central-1.amazonaws.com/hits_compatible/athena/hits.parquet |
| 27 | + ;; |
| 28 | + partitioned) |
| 29 | + seq 0 99 | xargs -P100 -I{} bash -c 'wget --continue https://datasets.clickhouse.com/hits_compatible/athena_partitioned/hits_{}.parquet' |
| 30 | + ;; |
| 31 | + *) |
| 32 | + echo "Invalid argument to 'benchmark.sh', expected 'single' or 'partitioned'" |
| 33 | + exit 1 |
| 34 | + ;; |
| 35 | +esac |
| 36 | +popd |
19 | 37 |
|
20 | | -cat log.txt | grep -oP 'Time: \d+\.\d+s|Error' | sed -r -e 's/Time: ([0-9]+\.[0-9]+)s/\1/; s/Error/null/' | awk '{ if (i % 3 == 0) { printf "[" }; printf $1; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }' |
| 38 | +# Ensure working directory is the script dir. The view that gets created uses a |
| 39 | +# relative path. |
| 40 | +pushd "${script_dir}" |
| 41 | + |
| 42 | +./run.sh "${mode}" |
0 commit comments