add examples that require rewrite of SELECT expr list to test [#CLICKHOUSE-3145]

This commit is contained in:
Alexey Zatelepin 2018-12-06 21:51:49 +03:00
parent d70533d538
commit df76b1c23a
2 changed files with 16 additions and 10 deletions

View File

@ -1,4 +1,4 @@
CREATE MATERIALIZED VIEW test.t_mv ( date Date, platform Enum8('a' = 0, 'b' = 1), app Enum8('a' = 0, 'b' = 1)) ENGINE = MergeTree ORDER BY date SETTINGS index_granularity = 8192 AS SELECT date, platform, app FROM test.t WHERE (app = (SELECT min(app) FROM test.u )) AND (platform = (SELECT min(platform) FROM test.v ))
CREATE MATERIALIZED VIEW test.t_mv ( date Date, platform Enum8('a' = 0, 'b' = 1), app Enum8('a' = 0, 'b' = 1)) ENGINE = MergeTree ORDER BY date SETTINGS index_granularity = 8192 AS SELECT date, platform, app FROM test.t WHERE (app = (SELECT min(app) FROM test.u )) AND (platform = (SELECT (SELECT min(platform) FROM test.v )))
2000-01-01 a a
2000-01-02 b b
2000-01-03 a a

View File

@ -20,19 +20,25 @@ INSERT INTO v VALUES ('b');
CREATE MATERIALIZED VIEW t_mv ENGINE = MergeTree ORDER BY date
AS SELECT date, platform, app FROM t
WHERE app = (SELECT min(app) from u) AND platform = (SELECT min(platform) from v);
WHERE app = (SELECT min(app) from u) AND platform = (SELECT (SELECT min(platform) from v));
SHOW CREATE TABLE test.t_mv FORMAT TabSeparatedRaw;
INSERT INTO t VALUES ('2000-01-01', 'a', 'a') ('2000-01-02', 'b', 'b');
USE default;
DETACH TABLE test.t_mv;
ATTACH TABLE test.t_mv;
INSERT INTO u VALUES ('a');
INSERT INTO v VALUES ('a');
INSERT INTO test.t VALUES ('2000-01-01', 'a', 'a') ('2000-01-02', 'b', 'b');
INSERT INTO t VALUES ('2000-01-03', 'a', 'a') ('2000-01-04', 'b', 'b');
INSERT INTO test.u VALUES ('a');
INSERT INTO test.v VALUES ('a');
SELECT * FROM t ORDER BY date;
SELECT * FROM t_mv ORDER BY date;
INSERT INTO test.t VALUES ('2000-01-03', 'a', 'a') ('2000-01-04', 'b', 'b');
DROP TABLE IF EXISTS t;
DROP TABLE IF EXISTS t_mv;
SELECT * FROM test.t ORDER BY date;
SELECT * FROM test.t_mv ORDER BY date;
DROP TABLE test.t;
DROP TABLE test.t_mv;
DROP TABLE test.u;
DROP TABLE test.v;