ClickHouse/dbms/tests/queries/0_stateless/00563_complex_in_expression.sql

33 lines
891 B
MySQL
Raw Normal View History

DROP TABLE IF EXISTS test;
CREATE TABLE test ( dt Date, site_id Int32, site_key String ) ENGINE = MergeTree(dt, (site_id, site_key, dt), 8192);
INSERT INTO test (dt,site_id, site_key) VALUES ('2018-1-29', 100, 'key');
SELECT * FROM test WHERE toInt32(site_id) IN (100);
SELECT * FROM test WHERE toInt32(site_id) IN (100,101);
DROP TABLE IF EXISTS test;
DROP TABLE IF EXISTS join_with_index;
CREATE TABLE join_with_index (key UInt32, data UInt64) ENGINE = MergeTree ORDER BY key SETTINGS index_granularity=1;
INSERT INTO join_with_index VALUES (1, 0), (2, 99);
SELECT key + 1
FROM join_with_index
ALL INNER JOIN
(
SELECT
key,
data
FROM join_with_index
WHERE toUInt64(data) IN (0, 529335254087962442)
) USING (key);
SELECT _uniq, _uniq IN (0, 99)
FROM join_with_index
ARRAY JOIN
[key, data] AS _uniq
ORDER BY _uniq;
DROP TABLE IF EXISTS join_with_index;