2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS test;
|
|
|
|
DROP TABLE IF EXISTS mv_bad;
|
|
|
|
DROP TABLE IF EXISTS mv_good;
|
|
|
|
DROP TABLE IF EXISTS mv_group;
|
2018-08-08 03:09:59 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
CREATE TABLE test (x String) ENGINE = Null;
|
2018-08-08 03:09:59 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
create MATERIALIZED VIEW mv_bad (x String)
|
2018-08-08 03:09:59 +00:00
|
|
|
ENGINE = MergeTree Partition by tuple() order by tuple()
|
2019-04-16 14:13:13 +00:00
|
|
|
AS SELECT DISTINCT x FROM test;
|
2018-08-08 03:09:59 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
create MATERIALIZED VIEW mv_good (x String)
|
2018-08-08 03:09:59 +00:00
|
|
|
ENGINE = MergeTree Partition by tuple() order by tuple()
|
2019-04-16 14:13:13 +00:00
|
|
|
AS SELECT x FROM test;
|
2018-08-08 03:09:59 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
create MATERIALIZED VIEW mv_group (x String)
|
2018-08-08 03:09:59 +00:00
|
|
|
ENGINE = MergeTree Partition by tuple() order by tuple()
|
2019-04-16 14:13:13 +00:00
|
|
|
AS SELECT x FROM test group by x;
|
2018-08-08 03:09:59 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
insert into test values ('stest'), ('stest');
|
2018-08-08 03:09:59 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
select * from mv_bad;
|
2018-08-08 03:09:59 +00:00
|
|
|
SELECT '---';
|
2019-04-16 14:13:13 +00:00
|
|
|
select * from mv_good;
|
2018-08-08 03:09:59 +00:00
|
|
|
SELECT '---';
|
2019-04-16 14:13:13 +00:00
|
|
|
select * from mv_group;
|
2018-08-08 03:09:59 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE mv_bad;
|
|
|
|
DROP TABLE mv_good;
|
|
|
|
DROP TABLE mv_group;
|
|
|
|
DROP TABLE test;
|