mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
Modified tests [#CLICKHOUSE-2838].
This commit is contained in:
parent
cb67224b4f
commit
f52ceced2b
@ -1,3 +0,0 @@
|
|||||||
DROP TABLE IF EXISTS arrays_test;
|
|
||||||
CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = Memory;
|
|
||||||
INSERT INTO arrays_test VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []);
|
|
@ -1,3 +0,0 @@
|
|||||||
Hello [1,2]
|
|
||||||
World [3,4,5]
|
|
||||||
Goodbye []
|
|
@ -1 +0,0 @@
|
|||||||
SELECT * FROM arrays_test
|
|
@ -1,5 +0,0 @@
|
|||||||
Hello 1
|
|
||||||
Hello 2
|
|
||||||
World 3
|
|
||||||
World 4
|
|
||||||
World 5
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, arr FROM arrays_test ARRAY JOIN arr
|
|
@ -1,5 +0,0 @@
|
|||||||
Hello [1,2] 1
|
|
||||||
Hello [1,2] 2
|
|
||||||
World [3,4,5] 3
|
|
||||||
World [3,4,5] 4
|
|
||||||
World [3,4,5] 5
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, arr, a FROM arrays_test ARRAY JOIN arr AS a
|
|
@ -1,5 +0,0 @@
|
|||||||
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
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, arr, a, num FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num
|
|
@ -1,5 +0,0 @@
|
|||||||
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]
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, arr, a, num, arrayEnumerate(arr) FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS num
|
|
@ -1,5 +0,0 @@
|
|||||||
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
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, arr, a, mapped FROM arrays_test ARRAY JOIN arr AS a, arrayMap(x -> x + 1, arr) AS mapped
|
|
@ -1,5 +0,0 @@
|
|||||||
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
|
|
@ -1 +0,0 @@
|
|||||||
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
|
|
@ -1 +0,0 @@
|
|||||||
15 15 3
|
|
@ -1,2 +0,0 @@
|
|||||||
SELECT sumArray(arr), sumArrayIf(arr, s LIKE '%l%'), sumArrayIf(arr, s LIKE '%e%') FROM arrays_test
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
Hello [1,2]
|
||||||
|
World [3,4,5]
|
||||||
|
Goodbye []
|
||||||
|
Hello 1
|
||||||
|
Hello 2
|
||||||
|
World 3
|
||||||
|
World 4
|
||||||
|
World 5
|
||||||
|
Hello [1,2] 1
|
||||||
|
Hello [1,2] 2
|
||||||
|
World [3,4,5] 3
|
||||||
|
World [3,4,5] 4
|
||||||
|
World [3,4,5] 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
|
||||||
|
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]
|
||||||
|
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
|
||||||
|
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
|
||||||
|
15 15 3
|
@ -0,0 +1,9 @@
|
|||||||
|
DROP TABLE IF EXISTS arrays_test;
|
||||||
|
CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = Memory;
|
||||||
|
INSERT INTO arrays_test VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []);
|
||||||
|
SELECT * FROM arrays_test
|
||||||
|
SELECT s, arr FROM arrays_test ARRAY JOIN arr
|
||||||
|
SELECT s, arr, a FROM arrays_test ARRAY JOIN arr AS aSELECT s, arr, a, num FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS numSELECT s, arr, a, num, arrayEnumerate(arr) FROM arrays_test ARRAY JOIN arr AS a, arrayEnumerate(arr) AS numSELECT s, arr, a, mapped FROM arrays_test ARRAY JOIN arr AS a, arrayMap(x -> x + 1, arr) AS mapped
|
||||||
|
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
|
||||||
|
SELECT sumArray(arr), sumArrayIf(arr, s LIKE '%l%'), sumArrayIf(arr, s LIKE '%e%') FROM arrays_test
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
DROP TABLE IF EXISTS nested_test;
|
|
||||||
CREATE TABLE nested_test (s String, nest Nested(x UInt8, y UInt32)) ENGINE = Memory;
|
|
||||||
INSERT INTO nested_test VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []);
|
|
@ -1,3 +0,0 @@
|
|||||||
Hello [1,2] [10,20]
|
|
||||||
World [3,4,5] [30,40,50]
|
|
||||||
Goodbye [] []
|
|
@ -1 +0,0 @@
|
|||||||
SELECT * FROM nested_test
|
|
@ -1,5 +0,0 @@
|
|||||||
Hello 1 10
|
|
||||||
Hello 2 20
|
|
||||||
World 3 30
|
|
||||||
World 4 40
|
|
||||||
World 5 50
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest
|
|
@ -1,5 +0,0 @@
|
|||||||
Hello 1 [10,20]
|
|
||||||
Hello 2 [10,20]
|
|
||||||
World 3 [30,40,50]
|
|
||||||
World 4 [30,40,50]
|
|
||||||
World 5 [30,40,50]
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x
|
|
@ -1,5 +0,0 @@
|
|||||||
Hello 1 10
|
|
||||||
Hello 2 20
|
|
||||||
World 3 30
|
|
||||||
World 4 40
|
|
||||||
World 5 50
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x, nest.y
|
|
@ -1,5 +0,0 @@
|
|||||||
Hello 1 10
|
|
||||||
Hello 2 20
|
|
||||||
World 3 30
|
|
||||||
World 4 40
|
|
||||||
World 5 50
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, n.x, n.y FROM nested_test ARRAY JOIN nest AS n
|
|
@ -1,5 +0,0 @@
|
|||||||
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]
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, n.x, n.y, nest.x FROM nested_test ARRAY JOIN nest AS n
|
|
@ -1,5 +0,0 @@
|
|||||||
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]
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, n.x, n.y, nest.x, nest.y FROM nested_test ARRAY JOIN nest AS n
|
|
@ -1,5 +0,0 @@
|
|||||||
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
|
|
@ -1 +0,0 @@
|
|||||||
SELECT s, n.x, n.y, nest.x, nest.y, num FROM nested_test ARRAY JOIN nest AS n, arrayEnumerate(nest.x) AS num
|
|
@ -0,0 +1,38 @@
|
|||||||
|
Hello [1,2] [10,20]
|
||||||
|
World [3,4,5] [30,40,50]
|
||||||
|
Goodbye [] []
|
||||||
|
Hello 1 10
|
||||||
|
Hello 2 20
|
||||||
|
World 3 30
|
||||||
|
World 4 40
|
||||||
|
World 5 50
|
||||||
|
Hello 1 [10,20]
|
||||||
|
Hello 2 [10,20]
|
||||||
|
World 3 [30,40,50]
|
||||||
|
World 4 [30,40,50]
|
||||||
|
World 5 [30,40,50]
|
||||||
|
Hello 1 10
|
||||||
|
Hello 2 20
|
||||||
|
World 3 30
|
||||||
|
World 4 40
|
||||||
|
World 5 50
|
||||||
|
Hello 1 10
|
||||||
|
Hello 2 20
|
||||||
|
World 3 30
|
||||||
|
World 4 40
|
||||||
|
World 5 50
|
||||||
|
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]
|
||||||
|
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]
|
||||||
|
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,7 @@
|
|||||||
|
DROP TABLE IF EXISTS nested_test;
|
||||||
|
CREATE TABLE nested_test (s String, nest Nested(x UInt8, y UInt32)) ENGINE = Memory;
|
||||||
|
INSERT INTO nested_test VALUES ('Hello', [1,2], [10,20]), ('World', [3,4,5], [30,40,50]), ('Goodbye', [], []);
|
||||||
|
SELECT * FROM nested_test
|
||||||
|
SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest
|
||||||
|
SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x
|
||||||
|
SELECT s, nest.x, nest.y FROM nested_test ARRAY JOIN nest.x, nest.ySELECT s, n.x, n.y FROM nested_test ARRAY JOIN nest AS nSELECT s, n.x, n.y, nest.x FROM nested_test ARRAY JOIN nest AS nSELECT s, n.x, n.y, nest.x, nest.y FROM nested_test ARRAY JOIN nest AS nSELECT s, n.x, n.y, nest.x, nest.y, num FROM nested_test ARRAY JOIN nest AS n, arrayEnumerate(nest.x) AS num
|
@ -1,30 +1,30 @@
|
|||||||
DROP TABLE IF EXISTS alter_test;
|
DROP TABLE IF EXISTS test.alter_test;
|
||||||
|
|
||||||
CREATE TABLE alter_test (CounterID UInt32, StartDate Date, UserID UInt32, VisitID UInt32, NestedColumn Nested(A UInt8, S String), ToDrop UInt32) ENGINE = MergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192);
|
CREATE TABLE test.alter_test (CounterID UInt32, StartDate Date, UserID UInt32, VisitID UInt32, NestedColumn Nested(A UInt8, S String), ToDrop UInt32) ENGINE = MergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192);
|
||||||
|
|
||||||
INSERT INTO alter_test VALUES (1, '2014-01-01', 2, 3, [1,2,3], ['a','b','c'], 4);
|
INSERT INTO test.alter_test VALUES (1, '2014-01-01', 2, 3, [1,2,3], ['a','b','c'], 4);
|
||||||
|
|
||||||
ALTER TABLE alter_test ADD COLUMN Added0 UInt32;
|
ALTER TABLE test.alter_test ADD COLUMN Added0 UInt32;
|
||||||
ALTER TABLE alter_test ADD COLUMN Added2 UInt32;
|
ALTER TABLE test.alter_test ADD COLUMN Added2 UInt32;
|
||||||
ALTER TABLE alter_test ADD COLUMN Added1 UInt32 AFTER Added0;
|
ALTER TABLE test.alter_test ADD COLUMN Added1 UInt32 AFTER Added0;
|
||||||
|
|
||||||
ALTER TABLE alter_test ADD COLUMN AddedNested1 Nested(A UInt32, B UInt64) AFTER Added2;
|
ALTER TABLE test.alter_test ADD COLUMN AddedNested1 Nested(A UInt32, B UInt64) AFTER Added2;
|
||||||
ALTER TABLE alter_test ADD COLUMN AddedNested1.C Array(String) AFTER AddedNested1.B;
|
ALTER TABLE test.alter_test ADD COLUMN AddedNested1.C Array(String) AFTER AddedNested1.B;
|
||||||
ALTER TABLE alter_test ADD COLUMN AddedNested2 Nested(A UInt32, B UInt64) AFTER AddedNested1;
|
ALTER TABLE test.alter_test ADD COLUMN AddedNested2 Nested(A UInt32, B UInt64) AFTER AddedNested1;
|
||||||
|
|
||||||
DESC TABLE alter_test;
|
DESC TABLE test.alter_test;
|
||||||
|
|
||||||
ALTER TABLE alter_test DROP COLUMN ToDrop;
|
ALTER TABLE test.alter_test DROP COLUMN ToDrop;
|
||||||
|
|
||||||
ALTER TABLE alter_test MODIFY COLUMN Added0 String;
|
ALTER TABLE test.alter_test MODIFY COLUMN Added0 String;
|
||||||
|
|
||||||
ALTER TABLE alter_test DROP COLUMN NestedColumn.A;
|
ALTER TABLE test.alter_test DROP COLUMN NestedColumn.A;
|
||||||
ALTER TABLE alter_test DROP COLUMN NestedColumn.S;
|
ALTER TABLE test.alter_test DROP COLUMN NestedColumn.S;
|
||||||
|
|
||||||
ALTER TABLE alter_test DROP COLUMN AddedNested1.B;
|
ALTER TABLE test.alter_test DROP COLUMN AddedNested1.B;
|
||||||
|
|
||||||
DESC TABLE alter_test;
|
DESC TABLE test.alter_test;
|
||||||
|
|
||||||
SELECT * FROM alter_test;
|
SELECT * FROM test.alter_test;
|
||||||
|
|
||||||
DROP TABLE alter_test;
|
DROP TABLE test.alter_test;
|
||||||
|
Loading…
Reference in New Issue
Block a user