ClickHouse/tests/queries/0_stateless/01046_materialized_view_with_join_over_distributed.sql
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

19 lines
683 B
SQL

-- from https://github.com/ClickHouse/ClickHouse/issues/5142
DROP TABLE IF EXISTS t;
DROP TABLE IF EXISTS t_d;
DROP TABLE IF EXISTS t_v;
CREATE TABLE t (`A` Int64) ENGINE = MergeTree() ORDER BY tuple();
CREATE TABLE t_d AS t ENGINE = Distributed(test_shard_localhost, currentDatabase(), t);
CREATE MATERIALIZED VIEW t_v ENGINE = MergeTree() ORDER BY tuple() AS SELECT A FROM t LEFT JOIN ( SELECT toInt64(dummy) AS A FROM system.one ) js2 USING (A);
INSERT INTO t_d SELECT number FROM numbers(2);
SELECT * FROM t_v ORDER BY A;
INSERT INTO t SELECT number+2 FROM numbers(2);
SELECT * FROM t_v ORDER BY A;
DROP TABLE IF EXISTS t_v;
DROP TABLE IF EXISTS t_d;
DROP TABLE IF EXISTS t;