ClickHouse/dbms/tests/queries/0_stateless/00609_distributed_with_case_when_then.sql

17 lines
857 B
MySQL
Raw Normal View History

2019-06-03 17:36:27 +00:00
DROP TABLE IF EXISTS mergetree_00609;
DROP TABLE IF EXISTS distributed_00609;
2019-06-03 17:36:27 +00:00
CREATE TABLE mergetree_00609 (x UInt64, s String) ENGINE = MergeTree ORDER BY x;
INSERT INTO mergetree_00609 VALUES (1, 'hello'), (2, 'world');
2019-06-03 17:36:27 +00:00
SELECT CASE x WHEN 1 THEN 'hello' WHEN 2 THEN 'world' ELSE 'unknow' END FROM mergetree_00609;
SELECT count() AS cnt FROM (SELECT CASE x WHEN 1 THEN 'hello' WHEN 2 THEN 'world' ELSE 'unknow' END FROM mergetree_00609);
2019-06-03 17:36:27 +00:00
CREATE TABLE distributed_00609 AS mergetree_00609 ENGINE = Distributed(test_shard_localhost, currentDatabase(), mergetree_00609);
2019-06-03 17:36:27 +00:00
SELECT CASE x WHEN 1 THEN 'hello' WHEN 2 THEN 'world' ELSE 'unknow' END FROM distributed_00609;
SELECT count() AS cnt FROM (SELECT CASE x WHEN 1 THEN 'hello' WHEN 2 THEN 'world' ELSE 'unknow' END FROM distributed_00609);
2019-06-03 17:36:27 +00:00
DROP TABLE mergetree_00609;
DROP TABLE distributed_00609;