Skip to content

Commit 7bc84b8

Browse files
committed
Merge branch 'main' of https://github.com/datafuselabs/databend into add_runtime_bloom_filter_for_merge_into
2 parents f1ad0cd + 9b47de7 commit 7bc84b8

File tree

123 files changed

+1942
-356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1942
-356
lines changed

โ€Ž.github/actions/benchmark_cloud/action.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,31 @@ runs:
4141
sudo apt-get update -yq
4242
sudo apt-get install -yq python3
4343
44+
- name: Prepare
45+
working-directory: benchmark/clickbench
46+
shell: bash
47+
id: prepare
48+
env:
49+
BENDSQL_DSN: "databend://${{ inputs.cloud_user }}:${{ inputs.cloud_password }}@${{ inputs.cloud_gateway }}:443"
50+
run: |
51+
if [[ "${{ inputs.dataset }}" == "load" ]]; then
52+
echo "CREATE DATABASE IF NOT EXISTS load_test_${{ inputs.run_id }};" | bendsql
53+
echo "database=load_test_${{ inputs.run_id }}" >> $GITHUB_OUTPUT
54+
echo "tries=1" >> $GITHUB_OUTPUT
55+
else
56+
echo "database=clickbench" >> $GITHUB_OUTPUT
57+
echo "tries=3" >> $GITHUB_OUTPUT
58+
fi
59+
4460
- name: Run Benchmark
4561
working-directory: benchmark/clickbench
4662
env:
4763
BENCHMARK_ID: ${{ inputs.run_id }}
4864
BENCHMARK_DATASET: ${{ inputs.dataset }}
4965
BENCHMARK_SIZE: ${{ inputs.size }}
5066
BENCHMARK_VERSION: ${{ inputs.version }}
51-
BENCHMARK_DATABASE: clickbench
67+
BENCHMARK_DATABASE: ${{ steps.prepare.outputs.database }}
68+
BENCHMARK_TRIES: ${{ steps.prepare.outputs.tries }}
5269
CLOUD_USER: ${{ inputs.cloud_user }}
5370
CLOUD_PASSWORD: ${{ inputs.cloud_password }}
5471
CLOUD_GATEWAY: ${{ inputs.cloud_gateway }}

โ€Žbenchmark/clickbench/benchmark_cloud.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ BENCHMARK_SIZE=${BENCHMARK_SIZE:-Small}
88
BENCHMARK_CACHE_SIZE=${BENCHMARK_CACHE_SIZE:-0}
99
BENCHMARK_VERSION=${BENCHMARK_VERSION:-}
1010
BENCHMARK_DATABASE=${BENCHMARK_DATABASE:-default}
11+
BENCHMARK_TRIES=${BENCHMARK_TRIES:-3}
1112

1213
if [[ -z "${BENCHMARK_VERSION}" ]]; then
1314
echo "Please set BENCHMARK_VERSION to run the benchmark."
@@ -76,16 +77,18 @@ bendsql --query="select * from system.settings where value != default;" -o table
7677
echo "Running queries..."
7778

7879
# analyze table
79-
echo "Analyze table..."
80-
bendsql <"${BENCHMARK_DATASET}/analyze.sql"
80+
if [[ -f "${BENCHMARK_DATASET}/analyze.sql" ]]; then
81+
echo "Analyze table..."
82+
bendsql <"${BENCHMARK_DATASET}/analyze.sql"
83+
fi
8184

8285
function run_query() {
8386
local query_num=$1
8487
local seq=$2
8588
local query=$3
8689

8790
local q_time
88-
q_time=$(echo "$query" | bendsql --time=server)
91+
q_time=$(bendsql --time=server <"$query")
8992
if [[ -n $q_time ]]; then
9093
echo "Q${query_num}[$seq] succeeded in $q_time seconds"
9194
yq -i ".result[${query_num}] += [${q_time}]" -o json result.json
@@ -94,16 +97,20 @@ function run_query() {
9497
fi
9598
}
9699

97-
TRIES=3
98100
QUERY_NUM=0
99-
while read -r query; do
101+
for query in "${BENCHMARK_DATASET}"/queries/*.sql; do
100102
echo "Running Q${QUERY_NUM}: ${query}"
101103
yq -i ".result += [[]]" -o json result.json
102-
for i in $(seq 1 $TRIES); do
104+
for i in $(seq 1 "$BENCHMARK_TRIES"); do
103105
run_query "$QUERY_NUM" "$i" "$query"
104106
done
105107
QUERY_NUM=$((QUERY_NUM + 1))
106-
done <"${BENCHMARK_DATASET}/queries.sql"
108+
done
107109

108110
echo "Cleaning up..."
111+
if [[ "${BENCHMARK_DATASET}" == "load" ]]; then
112+
echo "Dropping database..."
113+
echo "DROP DATABASE IF EXISTS ${BENCHMARK_DATABASE};" | bendsql
114+
fi
115+
echo "Drop warehouse..."
109116
echo "DROP WAREHOUSE IF EXISTS '${CLOUD_WAREHOUSE}';" | bendsql

โ€Žbenchmark/clickbench/benchmark_local.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,16 @@ instance_type=$(curl -H "X-aws-ec2-metadata-token: $token" http://169.254.169.25
7070
echo "Instance type: ${instance_type}"
7171

7272
# Load data
73-
if [ "${BENCHMARK_DATASET}" == "internal" ]; then
73+
echo "Loading data..."
74+
load_start=$(date +%s)
75+
if [[ -f "${BENCHMARK_DATASET}/load.sh" ]]; then
7476
bash "${BENCHMARK_DATASET}"/load.sh
75-
load_time=0
7677
else
77-
echo "Loading data..."
78-
load_start=$(date +%s)
7978
bendsql <"${BENCHMARK_DATASET}/load.sql"
80-
load_end=$(date +%s)
81-
load_time=$(python3 -c "print($load_end - $load_start)")
82-
echo "Data loaded in ${load_time}s."
8379
fi
80+
load_end=$(date +%s)
81+
load_time=$(python3 -c "print($load_end - $load_start)")
82+
echo "Data loaded in ${load_time}s."
8483

8584
data_size=$(echo "select sum(data_compressed_size) from system.tables where database = '${BENCHMARK_DATASET}';" | bendsql -o tsv)
8685

@@ -99,7 +98,7 @@ function run_query() {
9998
local query=$3
10099

101100
local q_time
102-
q_time=$(echo "$query" | bendsql --time=server)
101+
q_time=$(bendsql --time=server <"$query")
103102
if [[ -n $q_time ]]; then
104103
echo "Q${query_num}[$seq] succeeded in $q_time seconds"
105104
yq -i ".result[${query_num}] += [${q_time}]" -o json result.json
@@ -110,7 +109,7 @@ function run_query() {
110109

111110
TRIES=3
112111
QUERY_NUM=0
113-
while read -r query; do
112+
for query in "${BENCHMARK_DATASET}"/queries/*.sql; do
114113
echo "Running Q${QUERY_NUM}: ${query}"
115114
sync
116115
echo 3 | sudo tee /proc/sys/vm/drop_caches
@@ -119,4 +118,4 @@ while read -r query; do
119118
run_query "$QUERY_NUM" "$i" "$query"
120119
done
121120
QUERY_NUM=$((QUERY_NUM + 1))
122-
done <"${BENCHMARK_DATASET}/queries.sql"
121+
done

โ€Žbenchmark/clickbench/hits/queries.sql

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SELECT COUNT(*)
2+
FROM hits;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT COUNT(*)
2+
FROM hits
3+
WHERE AdvEngineID <> 0;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SELECT SUM(AdvEngineID),
2+
COUNT(*),
3+
AVG(ResolutionWidth)
4+
FROM hits;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SELECT AVG(UserID)
2+
FROM hits;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SELECT COUNT(DISTINCT UserID)
2+
FROM hits;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SELECT COUNT(DISTINCT SearchPhrase)
2+
FROM hits;

0 commit comments

Comments
ย (0)