mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
dbms: added tests [#METR-2944].
This commit is contained in:
parent
fc45d3cc5b
commit
dae349ba00
@ -5,7 +5,7 @@
|
||||
# Результаты сравниваются с эталонами.
|
||||
|
||||
QUERIES_DIR="./queries"
|
||||
CLIENT_PROGRAM="clickhouse-client"
|
||||
CLIENT_PROGRAM="curl -sS http://localhost:8123/ --data-binary @-"
|
||||
|
||||
|
||||
COLOR_RESET="\033[0m"
|
||||
@ -50,6 +50,10 @@ do
|
||||
ERRORS=$(($ERRORS + 1))
|
||||
echo -e "$MSG_FAIL - having stderror:"
|
||||
cat $error_file
|
||||
elif grep -q "Exception" $result_file; then
|
||||
ERRORS=$(($ERRORS + 1))
|
||||
echo -e "$MSG_FAIL - having exception:"
|
||||
cat $result_file
|
||||
elif [ ! -e "$reference_file" ]; then
|
||||
# надо сгенерировать эталонный результат
|
||||
if [ "$1" == "--generate" ]; then
|
||||
|
@ -0,0 +1 @@
|
||||
2
|
@ -0,0 +1 @@
|
||||
SELECT count() FROM remote('127.0.0.{1,2}', system, one) WHERE arrayExists((x) -> x = 1, [1, 2, 3])
|
0
dbms/tests/queries/00006_1_set_extremes.reference
Normal file
0
dbms/tests/queries/00006_1_set_extremes.reference
Normal file
1
dbms/tests/queries/00006_1_set_extremes.sql
Normal file
1
dbms/tests/queries/00006_1_set_extremes.sql
Normal file
@ -0,0 +1 @@
|
||||
SET GLOBAL extremes = 1
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"meta":
|
||||
[
|
||||
{
|
||||
"name": "'Hello, world'",
|
||||
"type": "String"
|
||||
}
|
||||
],
|
||||
|
||||
"data":
|
||||
[
|
||||
|
||||
],
|
||||
|
||||
"rows": 0,
|
||||
|
||||
"rows_before_limit_at_least": 10
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
SELECT 'Hello, world' FROM (SELECT number FROM system.numbers LIMIT 10) WHERE number < 0
|
||||
FORMAT JSONCompact
|
0
dbms/tests/queries/00006_3_unset_extremes.reference
Normal file
0
dbms/tests/queries/00006_3_unset_extremes.reference
Normal file
1
dbms/tests/queries/00006_3_unset_extremes.sql
Normal file
1
dbms/tests/queries/00006_3_unset_extremes.sql
Normal file
@ -0,0 +1 @@
|
||||
SET GLOBAL extremes = 0
|
1
dbms/tests/queries/00007_array.reference
Normal file
1
dbms/tests/queries/00007_array.reference
Normal file
@ -0,0 +1 @@
|
||||
['Hello','Goodbye']
|
1
dbms/tests/queries/00007_array.sql
Normal file
1
dbms/tests/queries/00007_array.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT ['Hello', 'Goodbye']
|
2
dbms/tests/queries/00008_array_join.reference
Normal file
2
dbms/tests/queries/00008_array_join.reference
Normal file
@ -0,0 +1,2 @@
|
||||
Hello
|
||||
Goodbye
|
1
dbms/tests/queries/00008_array_join.sql
Normal file
1
dbms/tests/queries/00008_array_join.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT arrayJoin(['Hello', 'Goodbye'])
|
2
dbms/tests/queries/00009_array_join_subquery.reference
Normal file
2
dbms/tests/queries/00009_array_join_subquery.reference
Normal file
@ -0,0 +1,2 @@
|
||||
Hello
|
||||
Goodbye
|
1
dbms/tests/queries/00009_array_join_subquery.sql
Normal file
1
dbms/tests/queries/00009_array_join_subquery.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT x FROM (SELECT arrayJoin(['Hello', 'Goodbye']) AS x)
|
6
dbms/tests/queries/00010_big_array_join.reference
Normal file
6
dbms/tests/queries/00010_big_array_join.reference
Normal file
@ -0,0 +1,6 @@
|
||||
Hello
|
||||
Hello
|
||||
Hello
|
||||
Goodbye
|
||||
Goodbye
|
||||
Goodbye
|
1
dbms/tests/queries/00010_big_array_join.sql
Normal file
1
dbms/tests/queries/00010_big_array_join.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT x FROM (SELECT arrayJoin(['Hello', 'Goodbye']) AS x, [1, 2, 3] AS arr) ARRAY JOIN arr
|
6
dbms/tests/queries/00011_array_join_alias.reference
Normal file
6
dbms/tests/queries/00011_array_join_alias.reference
Normal file
@ -0,0 +1,6 @@
|
||||
Hello 1
|
||||
Hello 2
|
||||
Hello 3
|
||||
Goodbye 1
|
||||
Goodbye 2
|
||||
Goodbye 3
|
1
dbms/tests/queries/00011_array_join_alias.sql
Normal file
1
dbms/tests/queries/00011_array_join_alias.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT x, a FROM (SELECT arrayJoin(['Hello', 'Goodbye']) AS x, [1, 2, 3] AS arr) ARRAY JOIN arr AS a
|
6
dbms/tests/queries/00012_array_join_alias_2.reference
Normal file
6
dbms/tests/queries/00012_array_join_alias_2.reference
Normal file
@ -0,0 +1,6 @@
|
||||
Hello 1 [1,2,3]
|
||||
Hello 2 [1,2,3]
|
||||
Hello 3 [1,2,3]
|
||||
Goodbye 1 [1,2,3]
|
||||
Goodbye 2 [1,2,3]
|
||||
Goodbye 3 [1,2,3]
|
1
dbms/tests/queries/00012_array_join_alias_2.sql
Normal file
1
dbms/tests/queries/00012_array_join_alias_2.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT x, a, arr FROM (SELECT arrayJoin(['Hello', 'Goodbye']) AS x, [1, 2, 3] AS arr) ARRAY JOIN arr AS a
|
@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS arrays_test
|
1
dbms/tests/queries/00013_2_create_table_with_arrays.sql
Normal file
1
dbms/tests/queries/00013_2_create_table_with_arrays.sql
Normal file
@ -0,0 +1 @@
|
||||
CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = Memory
|
@ -0,0 +1 @@
|
||||
INSERT INTO arrays_test VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', [])
|
@ -0,0 +1,3 @@
|
||||
Hello [1,2]
|
||||
World [3,4,5]
|
||||
Goodbye []
|
@ -0,0 +1 @@
|
||||
SELECT * FROM arrays_test
|
@ -0,0 +1,5 @@
|
||||
Hello 1
|
||||
Hello 2
|
||||
World 3
|
||||
World 4
|
||||
World 5
|
@ -0,0 +1 @@
|
||||
SELECT s, arr FROM arrays_test ARRAY JOIN arr
|
@ -0,0 +1,5 @@
|
||||
Hello [1,2] 1
|
||||
Hello [1,2] 2
|
||||
World [3,4,5] 3
|
||||
World [3,4,5] 4
|
||||
World [3,4,5] 5
|
@ -0,0 +1 @@
|
||||
SELECT s, arr, a FROM arrays_test ARRAY JOIN arr AS a
|
@ -0,0 +1,5 @@
|
||||
Hello [1,2] 1 1
|
||||
Hello [1,2] 2 2
|
||||
World [3,4,5] 3 1
|
||||
World [3,4,5] 4 2
|
||||
World [3,4,5] 5 3
|
@ -0,0 +1 @@
|
||||
SELECT s, arr, a, num FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num
|
@ -0,0 +1,5 @@
|
||||
Hello [1,2] 1 1 [1,2]
|
||||
Hello [1,2] 2 2 [1,2]
|
||||
World [3,4,5] 3 1 [1,2,3]
|
||||
World [3,4,5] 4 2 [1,2,3]
|
||||
World [3,4,5] 5 3 [1,2,3]
|
@ -0,0 +1 @@
|
||||
SELECT s, arr, a, num, arrayEnumerate(arr) FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num
|
@ -0,0 +1,5 @@
|
||||
Hello [1,2] 1 2
|
||||
Hello [1,2] 2 3
|
||||
World [3,4,5] 3 4
|
||||
World [3,4,5] 4 5
|
||||
World [3,4,5] 5 6
|
@ -0,0 +1 @@
|
||||
SELECT s, arr, a, mapped FROM arrays_test ARRAY JOIN arr AS a, arrayMap(x -> x + 1, arr) AS mapped
|
@ -0,0 +1,5 @@
|
||||
Hello [1,2] 1 1 2
|
||||
Hello [1,2] 2 2 3
|
||||
World [3,4,5] 3 1 4
|
||||
World [3,4,5] 4 2 5
|
||||
World [3,4,5] 5 3 6
|
@ -0,0 +1 @@
|
||||
SELECT s, arr, a, num, mapped FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num, arrayMap(x -> x + 1, arr) AS mapped
|
@ -0,0 +1 @@
|
||||
DROP TABLE IF EXISTS nested_test
|
1
dbms/tests/queries/00014_2_create_table_with_nested.sql
Normal file
1
dbms/tests/queries/00014_2_create_table_with_nested.sql
Normal file
@ -0,0 +1 @@
|
||||
CREATE TABLE nested_test (s String, nest Nested(x UInt8, y UInt32)) ENGINE = Memory
|
@ -0,0 +1 @@
|
||||
INSERT INTO nested_test VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], [])
|
@ -0,0 +1,3 @@
|
||||
Hello [1,2] [10,20]
|
||||
World [3,4,5] [30,40,50]
|
||||
Goodbye [] []
|
@ -0,0 +1 @@
|
||||
SELECT * FROM nested_test
|
@ -0,0 +1,5 @@
|
||||
Hello 1 10
|
||||
Hello 2 20
|
||||
World 3 30
|
||||
World 4 40
|
||||
World 5 50
|
@ -0,0 +1 @@
|
||||
SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest
|
@ -0,0 +1,5 @@
|
||||
Hello 1 [10,20]
|
||||
Hello 2 [10,20]
|
||||
World 3 [30,40,50]
|
||||
World 4 [30,40,50]
|
||||
World 5 [30,40,50]
|
@ -0,0 +1 @@
|
||||
SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x
|
@ -0,0 +1,5 @@
|
||||
Hello 1 10
|
||||
Hello 2 20
|
||||
World 3 30
|
||||
World 4 40
|
||||
World 5 50
|
@ -0,0 +1 @@
|
||||
SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x, nest.y
|
@ -0,0 +1,5 @@
|
||||
Hello 1 10
|
||||
Hello 2 20
|
||||
World 3 30
|
||||
World 4 40
|
||||
World 5 50
|
@ -0,0 +1 @@
|
||||
SELECT s, n.x, n.y FROM nested_test ARRAY JOIN nest AS n
|
@ -0,0 +1,5 @@
|
||||
Hello 1 10 [1,2]
|
||||
Hello 2 20 [1,2]
|
||||
World 3 30 [3,4,5]
|
||||
World 4 40 [3,4,5]
|
||||
World 5 50 [3,4,5]
|
@ -0,0 +1 @@
|
||||
SELECT s, n.x, n.y, nest.x FROM nested_test ARRAY JOIN nest AS n
|
@ -0,0 +1,5 @@
|
||||
Hello 1 10 [1,2] [10,20]
|
||||
Hello 2 20 [1,2] [10,20]
|
||||
World 3 30 [3,4,5] [30,40,50]
|
||||
World 4 40 [3,4,5] [30,40,50]
|
||||
World 5 50 [3,4,5] [30,40,50]
|
@ -0,0 +1 @@
|
||||
SELECT s, n.x, n.y, nest.x, nest.y FROM nested_test ARRAY JOIN nest AS n
|
@ -0,0 +1,5 @@
|
||||
Hello 1 10 [1,2] [10,20] 1
|
||||
Hello 2 20 [1,2] [10,20] 2
|
||||
World 3 30 [3,4,5] [30,40,50] 1
|
||||
World 4 40 [3,4,5] [30,40,50] 2
|
||||
World 5 50 [3,4,5] [30,40,50] 3
|
@ -0,0 +1 @@
|
||||
SELECT s, n.x, n.y, nest.x, nest.y, num FROM nested_test ARRAY JOIN nest AS n, arrayEnumerate(nest.x) AS num
|
12
dbms/tests/queries/00015_totals_having_constants.reference
Normal file
12
dbms/tests/queries/00015_totals_having_constants.reference
Normal file
@ -0,0 +1,12 @@
|
||||
0 10
|
||||
1 10
|
||||
5 10
|
||||
7 10
|
||||
2 10
|
||||
6 10
|
||||
4 10
|
||||
8 10
|
||||
3 10
|
||||
9 10
|
||||
|
||||
0 100
|
1
dbms/tests/queries/00015_totals_having_constants.sql
Normal file
1
dbms/tests/queries/00015_totals_having_constants.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT number, count() / 0.1 FROM (SELECT number FROM system.numbers LIMIT 10) GROUP BY number WITH TOTALS HAVING count() > 0.1
|
@ -0,0 +1,3 @@
|
||||
0 10
|
||||
|
||||
0 10
|
1
dbms/tests/queries/00016_totals_having_constants.sql
Normal file
1
dbms/tests/queries/00016_totals_having_constants.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT dummy, count() / 0.1 GROUP BY dummy WITH TOTALS HAVING count() > 0.1
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"meta":
|
||||
[
|
||||
{
|
||||
"name": "count()",
|
||||
"type": "UInt64"
|
||||
}
|
||||
],
|
||||
|
||||
"data":
|
||||
[
|
||||
|
||||
],
|
||||
|
||||
"rows": 0,
|
||||
|
||||
"rows_before_limit_at_least": 1000
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
SELECT count() FROM (SELECT * FROM system.numbers LIMIT 1000) WHERE 1 IN (SELECT 0 WHERE 0)
|
||||
FORMAT JSON
|
2
dbms/tests/queries/00018_distinct_in_subquery.reference
Normal file
2
dbms/tests/queries/00018_distinct_in_subquery.reference
Normal file
@ -0,0 +1,2 @@
|
||||
1
|
||||
1
|
1
dbms/tests/queries/00018_distinct_in_subquery.sql
Normal file
1
dbms/tests/queries/00018_distinct_in_subquery.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT x FROM (SELECT DISTINCT 1 AS x, arrayJoin([1, 2]) AS y)
|
Loading…
Reference in New Issue
Block a user