ClickHouse/tests/queries/0_stateless/01290_empty_array_index_analysis.sql
2020-05-30 00:32:35 +03:00

67 lines
1.7 KiB
SQL

drop table if exists count_lc_test;
CREATE TABLE count_lc_test
(
`s` LowCardinality(String),
`arr` Array(LowCardinality(String)),
`num` UInt64
)
ENGINE = MergeTree
ORDER BY (s, arr);
INSERT INTO count_lc_test(num, arr) VALUES (1,[]),(2,['a']),(3,['a','b','c']),(4,['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']);
SELECT '--- notEmpty';
select * from count_lc_test where notEmpty(arr);
SELECT '--- empty';
select * from count_lc_test where empty(arr);
SELECT '--- = []';
select * from count_lc_test where arr = [];
SELECT '--- != []';
select * from count_lc_test where arr != [];
SELECT '--- > []';
select * from count_lc_test where arr > [];
SELECT '--- < []';
select * from count_lc_test where arr < [];
SELECT '--- >= []';
select * from count_lc_test where arr >= [];
SELECT '--- <= []';
select * from count_lc_test where arr <= [];
SELECT '---';
DROP TABLE count_lc_test;
drop table if exists count_lc_test;
CREATE TABLE count_lc_test
(
`s` LowCardinality(String),
`arr` Array(String),
`num` UInt64
)
ENGINE = MergeTree
ORDER BY (s, arr);
INSERT INTO count_lc_test(num, arr) VALUES (1,[]),(2,['a']),(3,['a','b','c']),(4,['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa']);
SELECT '--- notEmpty';
select * from count_lc_test where notEmpty(arr);
SELECT '--- empty';
select * from count_lc_test where empty(arr);
SELECT '--- = []';
select * from count_lc_test where arr = [];
SELECT '--- != []';
select * from count_lc_test where arr != [];
SELECT '--- > []';
select * from count_lc_test where arr > [];
SELECT '--- < []';
select * from count_lc_test where arr < [];
SELECT '--- >= []';
select * from count_lc_test where arr >= [];
SELECT '--- <= []';
select * from count_lc_test where arr <= [];
SELECT '---';
DROP TABLE count_lc_test;