mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Updated test [#CLICKHOUSE-2].
This commit is contained in:
parent
80e48cc899
commit
50d09f08f5
@ -1,38 +1,47 @@
|
||||
----- NULL value -----
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
\N
|
||||
----- MergeTree engine -----
|
||||
1 1 a a [1] [1] ['a'] ['a'] 2000-01-01
|
||||
1 1 a a [1] [1] ['a'] [NULL] 2000-01-01
|
||||
1 1 a a [1] [NULL] ['a'] ['a'] 2000-01-01
|
||||
1 1 a \N [1] [1] ['a'] ['a'] 2000-01-01
|
||||
1 \N a a [1] [1] ['a'] ['a'] 2000-01-01
|
||||
----- Memory engine -----
|
||||
1 1 a a [1] [1] ['a'] ['a'] 2000-01-01
|
||||
1 1 a a [1] [1] ['a'] [NULL] 2000-01-01
|
||||
1 1 a a [1] [NULL] ['a'] ['a'] 2000-01-01
|
||||
1 1 a \N [1] [1] ['a'] ['a'] 2000-01-01
|
||||
1 \N a a [1] [1] ['a'] ['a'] 2000-01-01
|
||||
----- TinyLog engine -----
|
||||
1 1 a a [1] [1] ['a'] ['a'] 2000-01-01
|
||||
1 1 a a [1] [1] ['a'] [NULL] 2000-01-01
|
||||
1 1 a a [1] [NULL] ['a'] ['a'] 2000-01-01
|
||||
1 1 a \N [1] [1] ['a'] ['a'] 2000-01-01
|
||||
1 \N a a [1] [1] ['a'] ['a'] 2000-01-01
|
||||
----- Log engine -----
|
||||
1 1 a a [1] [1] ['a'] ['a'] 2000-01-01
|
||||
1 1 a a [1] [1] ['a'] [NULL] 2000-01-01
|
||||
1 1 a a [1] [NULL] ['a'] ['a'] 2000-01-01
|
||||
1 1 a \N [1] [1] ['a'] ['a'] 2000-01-01
|
||||
1 \N a a [1] [1] ['a'] ['a'] 2000-01-01
|
||||
----- StripeLog engine -----
|
||||
1 1 a a [1] [1] ['a'] ['a'] 2000-01-01
|
||||
1 1 a a [1] [1] ['a'] [NULL] 2000-01-01
|
||||
1 1 a a [1] [NULL] ['a'] ['a'] 2000-01-01
|
||||
1 1 a \N [1] [1] ['a'] ['a'] 2000-01-01
|
||||
1 \N a a [1] [1] ['a'] ['a'] 2000-01-01
|
||||
----- Insert with expression -----
|
||||
[2]
|
||||
----- Insert. Source and target columns have same types up to nullability. -----
|
||||
2 7
|
||||
4 3
|
||||
5 1
|
||||
6 9
|
||||
8 2
|
||||
----- Apply functions and aggregate functions on columns that may contain null values -----
|
||||
2 7 9 14
|
||||
5 1 6 35
|
||||
9 \N \N 63
|
||||
@ -41,12 +50,14 @@
|
||||
\N \N \N \N
|
||||
58
|
||||
406
|
||||
----- isNull, isNotNull -----
|
||||
2 7 0 1
|
||||
5 1 0 1
|
||||
9 \N 0 0
|
||||
42 42 0 1
|
||||
\N 6 1 1
|
||||
\N \N 1 0
|
||||
----- ifNull, nullIf -----
|
||||
2 7 2
|
||||
5 1 5
|
||||
9 \N 9
|
||||
@ -59,6 +70,7 @@
|
||||
42 42 \N
|
||||
\N 6 \N
|
||||
\N \N \N
|
||||
----- coalesce -----
|
||||
\N
|
||||
1
|
||||
1
|
||||
@ -76,16 +88,19 @@
|
||||
42 42 42
|
||||
\N 6 6
|
||||
\N \N 99
|
||||
----- assumeNotNull -----
|
||||
2
|
||||
5
|
||||
9
|
||||
42
|
||||
----- IS NULL, IS NOT NULL -----
|
||||
2
|
||||
5
|
||||
9
|
||||
42
|
||||
\N
|
||||
\N
|
||||
----- multiIf -----
|
||||
\N
|
||||
2
|
||||
\N
|
||||
@ -100,6 +115,7 @@ A\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
|
||||
1
|
||||
99
|
||||
99
|
||||
----- Array functions -----
|
||||
[NULL]
|
||||
[NULL,NULL,NULL]
|
||||
[NULL,2,3]
|
||||
@ -108,6 +124,8 @@ A\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
|
||||
[NULL,'b','c']
|
||||
['a',NULL,'c']
|
||||
['a','b',NULL]
|
||||
----- arrayElement -----
|
||||
----- constant arrays -----
|
||||
1
|
||||
\N
|
||||
2
|
||||
@ -120,6 +138,7 @@ d
|
||||
\N
|
||||
2
|
||||
3
|
||||
----- variable arrays -----
|
||||
2
|
||||
\N
|
||||
2
|
||||
@ -170,6 +189,8 @@ bc
|
||||
def
|
||||
ghij
|
||||
\N
|
||||
----- has -----
|
||||
----- constant arrays -----
|
||||
1
|
||||
1
|
||||
1
|
||||
@ -197,6 +218,7 @@ ghij
|
||||
1
|
||||
1
|
||||
1
|
||||
----- variable arrays -----
|
||||
1
|
||||
0
|
||||
1
|
||||
@ -270,6 +292,7 @@ ghij
|
||||
0
|
||||
0
|
||||
1
|
||||
----- Aggregation -----
|
||||
A 0 2
|
||||
A 1 2
|
||||
B 1 4
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
/* NULL value */
|
||||
SELECT '----- NULL value -----';
|
||||
|
||||
SELECT NULL;
|
||||
SELECT 1 + NULL;
|
||||
SELECT abs(NULL);
|
||||
SELECT NULL + NULL;
|
||||
|
||||
/* MergeTree engine */
|
||||
SELECT '----- MergeTree engine -----';
|
||||
|
||||
DROP TABLE IF EXISTS test.test1;
|
||||
CREATE TABLE test.test1(
|
||||
@ -24,7 +24,7 @@ INSERT INTO test.test1 VALUES (1, 1, 'a', 'a', [1], [1], ['a'], [NULL], '2000-01
|
||||
SELECT * FROM test.test1 ORDER BY col1,col2,col3,col4,col5,col6,col7,col8 ASC;
|
||||
|
||||
|
||||
/* Memory engine */
|
||||
SELECT '----- Memory engine -----';
|
||||
|
||||
DROP TABLE IF EXISTS test.test1;
|
||||
CREATE TABLE test.test1(
|
||||
@ -41,7 +41,7 @@ INSERT INTO test.test1 VALUES (1, 1, 'a', 'a', [1], [NULL], ['a'], ['a'], '2000-
|
||||
INSERT INTO test.test1 VALUES (1, 1, 'a', 'a', [1], [1], ['a'], [NULL], '2000-01-01');
|
||||
SELECT * FROM test.test1 ORDER BY col1,col2,col3,col4,col5,col6,col7,col8 ASC;
|
||||
|
||||
/* TinyLog engine */
|
||||
SELECT '----- TinyLog engine -----';
|
||||
|
||||
DROP TABLE IF EXISTS test.test1;
|
||||
CREATE TABLE test.test1(
|
||||
@ -58,7 +58,7 @@ INSERT INTO test.test1 VALUES (1, 1, 'a', 'a', [1], [NULL], ['a'], ['a'], '2000-
|
||||
INSERT INTO test.test1 VALUES (1, 1, 'a', 'a', [1], [1], ['a'], [NULL], '2000-01-01');
|
||||
SELECT * FROM test.test1 ORDER BY col1,col2,col3,col4,col5,col6,col7,col8 ASC;
|
||||
|
||||
/* Log engine */
|
||||
SELECT '----- Log engine -----';
|
||||
|
||||
DROP TABLE IF EXISTS test.test1;
|
||||
CREATE TABLE test.test1(
|
||||
@ -75,7 +75,7 @@ INSERT INTO test.test1 VALUES (1, 1, 'a', 'a', [1], [NULL], ['a'], ['a'], '2000-
|
||||
INSERT INTO test.test1 VALUES (1, 1, 'a', 'a', [1], [1], ['a'], [NULL], '2000-01-01');
|
||||
SELECT * FROM test.test1 ORDER BY col1,col2,col3,col4,col5,col6,col7,col8 ASC;
|
||||
|
||||
/* StripeLog engine */
|
||||
SELECT '----- StripeLog engine -----';
|
||||
|
||||
DROP TABLE IF EXISTS test.test1;
|
||||
CREATE TABLE test.test1(
|
||||
@ -93,14 +93,14 @@ INSERT INTO test.test1 VALUES (1, 1, 'a', 'a', [1], [1], ['a'], [NULL], '2000-01
|
||||
SELECT * FROM test.test1 ORDER BY col1,col2,col3,col4,col5,col6,col7,col8 ASC;
|
||||
|
||||
|
||||
/* Insert with expression */
|
||||
SELECT '----- Insert with expression -----';
|
||||
|
||||
DROP TABLE IF EXISTS test.test1;
|
||||
CREATE TABLE test.test1(col1 Array(Nullable(UInt64))) Engine=Memory;
|
||||
INSERT INTO test.test1(col1) VALUES ([1+1]);
|
||||
SELECT col1 FROM test.test1 ORDER BY col1 ASC;
|
||||
|
||||
/* Insert. Source and target columns have same types up to nullability. */
|
||||
SELECT '----- Insert. Source and target columns have same types up to nullability. -----';
|
||||
DROP TABLE IF EXISTS test.test1;
|
||||
CREATE TABLE test.test1(col1 Nullable(UInt64), col2 UInt64) Engine=Memory;
|
||||
DROP TABLE IF EXISTS test.test2;
|
||||
@ -109,7 +109,7 @@ INSERT INTO test.test1(col1,col2) VALUES (2,7)(6,9)(5,1)(4,3)(8,2);
|
||||
INSERT INTO test.test2(col1,col2) SELECT col1,col2 FROM test.test1;
|
||||
SELECT col1,col2 FROM test.test2 ORDER BY col1,col2 ASC;
|
||||
|
||||
/* Apply functions and aggregate functions on columns that may contain null values */
|
||||
SELECT '----- Apply functions and aggregate functions on columns that may contain null values -----';
|
||||
|
||||
DROP TABLE IF EXISTS test.test1;
|
||||
CREATE TABLE test.test1(col1 Nullable(UInt64), col2 Nullable(UInt64)) Engine=Memory;
|
||||
@ -118,16 +118,16 @@ SELECT col1, col2, col1 + col2, col1 * 7 FROM test.test1 ORDER BY col1,col2 ASC;
|
||||
SELECT sum(col1) FROM test.test1;
|
||||
SELECT sum(col1 * 7) FROM test.test1;
|
||||
|
||||
/* isNull, isNotNull */
|
||||
SELECT '----- isNull, isNotNull -----';
|
||||
|
||||
SELECT col1, col2, isNull(col1), isNotNull(col2) FROM test.test1 ORDER BY col1,col2 ASC;
|
||||
|
||||
/* ifNull, nullIf */
|
||||
SELECT '----- ifNull, nullIf -----';
|
||||
|
||||
SELECT col1, col2, ifNull(col1,col2) FROM test.test1 ORDER BY col1,col2 ASC;
|
||||
SELECT col1, col2, nullIf(col1,col2) FROM test.test1 ORDER BY col1,col2 ASC;
|
||||
|
||||
/* coalesce */
|
||||
SELECT '----- coalesce -----';
|
||||
|
||||
SELECT coalesce(NULL);
|
||||
SELECT coalesce(NULL, 1);
|
||||
@ -137,16 +137,16 @@ SELECT coalesce(NULL, NULL, NULL);
|
||||
SELECT col1, col2, coalesce(col1, col2) FROM test.test1 ORDER BY col1, col2 ASC;
|
||||
SELECT col1, col2, coalesce(col1, col2, 99) FROM test.test1 ORDER BY col1, col2 ASC;
|
||||
|
||||
/* assumeNotNull */
|
||||
SELECT '----- assumeNotNull -----';
|
||||
|
||||
SELECT res FROM (SELECT col1, assumeNotNull(col1) AS res FROM test.test1) WHERE col1 IS NOT NULL ORDER BY res ASC;
|
||||
|
||||
/* IS NULL, IS NOT NULL */
|
||||
SELECT '----- IS NULL, IS NOT NULL -----';
|
||||
|
||||
SELECT col1 FROM test.test1 WHERE col1 IS NOT NULL ORDER BY col1 ASC;
|
||||
SELECT col1 FROM test.test1 WHERE col1 IS NULL;
|
||||
|
||||
/* multiIf */
|
||||
SELECT '----- multiIf -----';
|
||||
|
||||
SELECT multiIf(1, NULL, 1, 3, 4);
|
||||
SELECT multiIf(1, 2, 1, NULL, 4);
|
||||
@ -168,7 +168,7 @@ CREATE TABLE test.test1(cond1 Nullable(UInt8), then1 Int8, cond2 UInt8, then2 Nu
|
||||
INSERT INTO test.test1(cond1,then1,cond2,then2,then3) VALUES(1,1,1,42,99)(0,7,1,99,42)(NULL,6,2,99,NULL);
|
||||
SELECT multiIf(cond1,then1,cond2,then2,then3) FROM test.test1;
|
||||
|
||||
/* Array functions */
|
||||
SELECT '----- Array functions -----';
|
||||
|
||||
SELECT [NULL];
|
||||
SELECT [NULL,NULL,NULL];
|
||||
@ -180,9 +180,9 @@ SELECT [NULL,'b','c'];
|
||||
SELECT ['a',NULL,'c'];
|
||||
SELECT ['a','b',NULL];
|
||||
|
||||
/* arrayElement */
|
||||
SELECT '----- arrayElement -----';
|
||||
|
||||
/* constant arrays */
|
||||
SELECT '----- constant arrays -----';
|
||||
|
||||
SELECT arrayElement([1,NULL,2,3], 1);
|
||||
SELECT arrayElement([1,NULL,2,3], 2);
|
||||
@ -200,7 +200,7 @@ INSERT INTO test.test1(col1) VALUES(1),(2),(3),(4);
|
||||
|
||||
SELECT arrayElement([1,NULL,2,3], col1) FROM test.test1;
|
||||
|
||||
/* variable arrays */
|
||||
SELECT '----- variable arrays -----';
|
||||
|
||||
DROP TABLE IF EXISTS test.test1;
|
||||
CREATE TABLE test.test1(col1 Array(Nullable(UInt64))) Engine=TinyLog;
|
||||
@ -248,9 +248,9 @@ INSERT INTO test.test1(col1,col2) VALUES([NULL,NULL,NULL,NULL],3);
|
||||
|
||||
SELECT arrayElement(col1,col2) FROM test.test1;
|
||||
|
||||
/* has */
|
||||
SELECT '----- has -----';
|
||||
|
||||
/* constant arrays */
|
||||
SELECT '----- constant arrays -----';
|
||||
|
||||
SELECT has([1,NULL,2,3], 1);
|
||||
SELECT has([1,NULL,2,3], NULL);
|
||||
@ -287,7 +287,7 @@ INSERT INTO test.test1(col1) VALUES('a'),('bc'),('def'),('ghij'),(NULL);
|
||||
|
||||
SELECT has(['a',NULL,'def','ghij'], col1) FROM test.test1;
|
||||
|
||||
/* variable arrays */
|
||||
SELECT '----- variable arrays -----';
|
||||
|
||||
DROP TABLE IF EXISTS test.test1;
|
||||
CREATE TABLE test.test1(col1 Array(Nullable(UInt64))) Engine=TinyLog;
|
||||
@ -356,7 +356,7 @@ INSERT INTO test.test1(col1,col2) VALUES([NULL,NULL,NULL,NULL], NULL);
|
||||
|
||||
SELECT has(col1,col2) FROM test.test1;
|
||||
|
||||
/* Aggregation */
|
||||
SELECT '----- Aggregation -----';
|
||||
|
||||
DROP TABLE IF EXISTS test.test1;
|
||||
CREATE TABLE test.test1(col1 Nullable(String), col2 Nullable(UInt8), col3 String) ENGINE=TinyLog;
|
||||
|
Loading…
Reference in New Issue
Block a user