From 4e3b9656fad71b2c9efe9bda0882f71c223189ec Mon Sep 17 00:00:00 2001 From: myrrc Date: Mon, 26 Oct 2020 17:43:09 +0300 Subject: [PATCH] fixed tests, updated master --- .../queries/0_stateless/01035_avg_weighted.sh | 39 --- .../01035_avg_weighted_long.reference | 228 ++++++++++++++++++ .../0_stateless/01035_avg_weighted_long.sh | 21 +- 3 files changed, 240 insertions(+), 48 deletions(-) delete mode 100644 tests/queries/0_stateless/01035_avg_weighted.sh diff --git a/tests/queries/0_stateless/01035_avg_weighted.sh b/tests/queries/0_stateless/01035_avg_weighted.sh deleted file mode 100644 index bb3e97a1d31..00000000000 --- a/tests/queries/0_stateless/01035_avg_weighted.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash - -CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) -. "$CUR_DIR"/../shell_config.sh - -${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(x, weight) FROM (SELECT t.1 AS x, t.2 AS weight FROM (SELECT arrayJoin([(1, 5), (2, 4), (3, 3), (4, 2), (5, 1)]) AS t));" -${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(x, weight) FROM (SELECT t.1 AS x, t.2 AS weight FROM (SELECT arrayJoin([(1, 0), (2, 0), (3, 0), (4, 0), (5, 0)]) AS t));" - -# Decimals not tested in types' combinations as they -# 1) Require different initialization (precision + scale) -# 2) Won't be used in these functions often -types=("Int8" "Int16" "Int32" "Int64" "Int128" "Int256" - "UInt8" "UInt16" "UInt32" "UInt64" "UInt128" "UInt256" - "Float32" "Float64") - -for left in "${types[@]}" -do - for right in "${types[@]}" - do - ${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(x, w) FROM values('x ${left}, w ${right}', (4, 1), (1, 0), (10, 2))" - ${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(x, w) FROM values('x ${left}, w ${right}', (8, 1), (122, 0))" - ${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(x, w) FROM values('x ${left}, w ${right}', (0, 0), (1, 0))" - done -done - -# Decimal types -dtypes=("32" "64" "128" "256") - -for left in "${dtypes[@]}" -do - for right in "${dtypes[@]}" - do - ${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(toDecimal${left}(2, 4), toDecimal${right}(1, 4))" - done -done - - -echo "$(${CLICKHOUSE_CLIENT} --server_logs_file=/dev/null --query="SELECT avgWeighted(['string'], toFloat64(0))" 2>&1)" \ - | grep -c 'Code: 43. DB::Exception: .* DB::Exception:.* Types .* of arguments are non-conforming as arguments for aggregate function avgWeighted' diff --git a/tests/queries/0_stateless/01035_avg_weighted_long.reference b/tests/queries/0_stateless/01035_avg_weighted_long.reference index e69de29bb2d..584f3184414 100644 --- a/tests/queries/0_stateless/01035_avg_weighted_long.reference +++ b/tests/queries/0_stateless/01035_avg_weighted_long.reference @@ -0,0 +1,228 @@ +2.3333333333333335 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +8 +nan +1 +1 +1 +1 +1 +1 +1 +1 +1 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 +1 diff --git a/tests/queries/0_stateless/01035_avg_weighted_long.sh b/tests/queries/0_stateless/01035_avg_weighted_long.sh index bb3e97a1d31..2d764918026 100755 --- a/tests/queries/0_stateless/01035_avg_weighted_long.sh +++ b/tests/queries/0_stateless/01035_avg_weighted_long.sh @@ -6,23 +6,27 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) ${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(x, weight) FROM (SELECT t.1 AS x, t.2 AS weight FROM (SELECT arrayJoin([(1, 5), (2, 4), (3, 3), (4, 2), (5, 1)]) AS t));" ${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(x, weight) FROM (SELECT t.1 AS x, t.2 AS weight FROM (SELECT arrayJoin([(1, 0), (2, 0), (3, 0), (4, 0), (5, 0)]) AS t));" -# Decimals not tested in types' combinations as they -# 1) Require different initialization (precision + scale) -# 2) Won't be used in these functions often -types=("Int8" "Int16" "Int32" "Int64" "Int128" "Int256" - "UInt8" "UInt16" "UInt32" "UInt64" "UInt128" "UInt256" - "Float32" "Float64") +types=("Int8" "Int16" "Int32" "Int64" "UInt8" "UInt16" "UInt32" "UInt64" "Float32" "Float64") for left in "${types[@]}" do for right in "${types[@]}" do ${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(x, w) FROM values('x ${left}, w ${right}', (4, 1), (1, 0), (10, 2))" - ${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(x, w) FROM values('x ${left}, w ${right}', (8, 1), (122, 0))" ${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(x, w) FROM values('x ${left}, w ${right}', (0, 0), (1, 0))" done done +exttypes=("Int128" "Int256" "UInt256") + +for left in "${exttypes[@]}" +do + for right in "${exttypes[@]}" + do + ${CLICKHOUSE_CLIENT} --query="SELECT avgWeighted(to${left}(1), to${right}(2))" + done +done + # Decimal types dtypes=("32" "64" "128" "256") @@ -34,6 +38,5 @@ do done done - echo "$(${CLICKHOUSE_CLIENT} --server_logs_file=/dev/null --query="SELECT avgWeighted(['string'], toFloat64(0))" 2>&1)" \ - | grep -c 'Code: 43. DB::Exception: .* DB::Exception:.* Types .* of arguments are non-conforming as arguments for aggregate function avgWeighted' + | grep -c 'Code: 43. DB::Exception: .* DB::Exception:.* Types .* are non-conforming as arguments for aggregate function avgWeighted'