ClickHouse/dbms/tests/perf_drafts/accurate_comparisons/accurate_comparisons.sh
Vitaliy Lyudvichenko 0807fb6d86 Interpret .py files in test dir as tests. [#CLICKHOUSE-194]
More precise performance test.
2017-01-12 18:21:47 +03:00

28 lines
919 B
Bash
Executable File

#!/bin/bash
set -e
clickhouse-client -q "DROP TABLE IF EXISTS test.comparisons"
clickhouse-client -q "CREATE TABLE test.comparisons (i64 Int64, u64 UInt64, f64 Float64) ENGINE = Memory"
clickhouse-client -q "INSERT INTO test.comparisons SELECT toInt64(rand64()) + number AS i64, number AS u64, reinterpretAsFloat64(reinterpretAsString(rand64())) AS f64 FROM system.numbers LIMIT 90000000"
function test_cmp {
echo -n "$1 : "
echo "SELECT count() FROM test.comparisons WHERE ($1)" | clickhouse-benchmark --max_threads=1 -i 20 -d 0 --json test.json 1>&2 2>/dev/null
python2 -c "import json; print json.load(open('test.json'))['query_time_percentiles']['0']"
rm test.json
}
test_cmp "u64 = i64"
test_cmp "u64 >= i64"
test_cmp "i64 > -1 "
test_cmp "i64 = 0 "
test_cmp "u64 != 0 "
test_cmp "i64 = f64"
test_cmp "i64 < f64"
test_cmp "f64 >= 0 "
clickhouse-client -q "DROP TABLE IF EXISTS test.comparisons"