ClickHouse/tests/sqllogic/self-test/test.test
2023-07-19 12:24:31 +00:00

155 lines
2.4 KiB
Plaintext

onlyif ClickHouse
statement ok
CREATE TABLE t1(a INTEGER, b INTEGER) ENGINE = MergeTree() PRIMARY KEY tuple()
skipif ClickHouse
statement ok
CREATE TABLE t1(a INTEGER, b INTEGER)
statement ok
INSERT INTO t1(a,b) VALUES(1,2)
statement ok
INSERT INTO t1(a,b) VALUES(3,4)
statement ok
INSERT INTO t1(a,b) VALUES(5,6)
# just ok request
query II nosort
SELECT a, b
FROM t1
ORDER BY 2,1
----
# will fail and write exception as a result
query II nosort
SELECT a, c
FROM t1
ORDER BY 2,1
----
# expect to fail
onlyif ClickHouse
query error UNKNOWN_IDENTIFIER
SELECT a, c FROM t1
----
# expect to fail
onlyif sqlite
query error No such column
SELECT a, c FROM t1
----
# expect to fail in a different way
query error expect to fail in a different way
SELECT a, c FROM t1
----
# print empty as (empty)
query T nosort
SELECT ''
----
(empty)
# without result set
query T nosort
SELECT ''
----
# without result and saparator
query T nosort
SELECT ''
# just ok with REAL
query R nosort
SELECT -1.0
----
-1.000
# just ok with signed
query I nosort
SELECT -1
----
-1
# just ok
query RI nosort
SELECT 1.0, 1
----
1.000 1
# mess with columns count
query R nosort
SELECT 1.0, 1
----
1.000 1
# mess with columns count
query RT nosort
SELECT 1.0
----
1.000
# empty result set
query II nosort
select a, b from t1 where a = b
----
# precise is 3 digits
query R nosort
SELECT 1.0013
----
1.001
query T nosort
SELECT NULL as a
----
NULL
onlyif ClickHouse
query I nosort
SELECT CAST(NULL AS Nullable(INTEGER))
----
NULL
query T nosort
SELECT NULL
----
NULL NULL
# thish check how result hashing works
query IIIIIIIIIIIIIII nosort
SELECT 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
----
skipif ClickHouse
query I nosort
WITH RECURSIVE
cnt(x) AS (
SELECT 1
UNION ALL
SELECT x+1 FROM cnt
LIMIT 20
)
SELECT x FROM cnt;
----
20 values hashing to 52c46dff81346ead02fcf6245c762b1a
onlyif ClickHouse
query I nosort
SELECT number+1 from system.numbers LIMIT 20
----
20 values hashing to 52c46dff81346ead02fcf6245c762b1a
# Debug how incorrect result type parses
statement ok
CREATE TABLE tab0(pk INTEGER PRIMARY KEY, col0 INTEGER, col1 FLOAT, col2 TEXT, col3 INTEGER, col4 FLOAT, col5 TEXT)
statement ok
INSERT INTO tab0 VALUES(0,535,860.48,'uxbns',253,640.58,'jvqkl')
skipif ClickHouse
query I rowsort label-20
SELECT + col2 AS col5 FROM tab0 WHERE NOT ( col0 ) * - - col4 IS NULL