ClickHouse/tests/perf_drafts/accurate_comparisons/accurate_comparisons.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
1.1 KiB
Bash
Raw Normal View History

2018-06-05 17:43:10 +00:00
#!/usr/bin/env 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
2020-10-02 16:54:07 +00:00
python3 -c "import json; print '%.3f' % float(json.load(open('test.json'))['query_time_percentiles']['0'])"
rm test.json
}
test_cmp "u64 > i64"
test_cmp "u64 > toInt64(1)"
test_cmp "i64 > u64"
test_cmp "i64 > toUInt64(1)"
test_cmp "u64 = i64"
test_cmp "u64 = toInt64(1)"
test_cmp "i64 = u64"
test_cmp "i64 = toUInt64(1)"
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"