2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS alter;
|
2015-04-08 21:27:35 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
CREATE TABLE alter (d Date DEFAULT toDate('2015-01-01'), n Nested(x String)) ENGINE = MergeTree(d, d, 8192);
|
2015-04-08 21:27:35 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO alter (`n.x`) VALUES (['Hello', 'World']);
|
2015-04-08 21:27:35 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT * FROM alter;
|
|
|
|
SELECT * FROM alter ARRAY JOIN n;
|
|
|
|
SELECT * FROM alter ARRAY JOIN n WHERE n.x LIKE '%Hello%';
|
2015-04-08 21:27:35 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
ALTER TABLE alter ADD COLUMN n.y Array(UInt64);
|
2015-04-08 21:27:35 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT * FROM alter;
|
|
|
|
SELECT * FROM alter ARRAY JOIN n;
|
|
|
|
SELECT * FROM alter ARRAY JOIN n WHERE n.x LIKE '%Hello%';
|
2015-04-08 21:27:35 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
INSERT INTO alter (`n.x`) VALUES (['Hello2', 'World2']);
|
2015-04-08 21:27:35 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT * FROM alter ORDER BY n.x;
|
|
|
|
SELECT * FROM alter ARRAY JOIN n ORDER BY n.x;
|
|
|
|
SELECT * FROM alter ARRAY JOIN n WHERE n.x LIKE '%Hello%' ORDER BY n.x;
|
2015-04-08 21:27:35 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
OPTIMIZE TABLE alter;
|
2015-04-08 21:27:35 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT * FROM alter;
|
|
|
|
SELECT * FROM alter ARRAY JOIN n;
|
|
|
|
SELECT * FROM alter ARRAY JOIN n WHERE n.x LIKE '%Hello%';
|
2015-04-08 21:27:35 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE alter;
|