提交 abf13ba0 编写于 作者: C chertus

test for insert_json_with_defaults + Nested

上级 e7f87bb7
......@@ -5,3 +5,6 @@
2 2 4 1.609438 2
3 3 3 3 3
4 0 4 1.609438 42
{"x":7,"y":7,"a":"14","b":2.7080503,"c":42,"n.a":["1","2"],"n.b":["a","b"]}
{"x":8,"y":8,"a":"16","b":2.8332133,"c":42,"n.a":["3","4"],"n.c":[0,0],"n.b":["c","d"]}
{"x":9,"y":9,"a":"18","b":2.944439,"c":42,"n.a":[],"n.c":[],"n.b":[]}
......@@ -2,7 +2,7 @@ SET insert_sample_with_metadata=1;
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS test.defaults;
CREATE TABLE IF NOT EXISTS test.defaults
CREATE TABLE test.defaults
(
x UInt32,
y UInt32,
......@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS test.defaults
c UInt32 DEFAULT 42,
e MATERIALIZED x + y,
f ALIAS x + y
) ENGINE = Memory;
) ENGINE = MergeTree ORDER BY x;
INSERT INTO test.defaults FORMAT JSONEachRow {"x":1, "y":1};
INSERT INTO test.defaults (x, y) SELECT x, y FROM test.defaults LIMIT 1;
......@@ -20,4 +20,14 @@ INSERT INTO test.defaults FORMAT JSONEachRow {"x":3, "y":3, "a":3, "b":3, "c":3}
INSERT INTO test.defaults FORMAT JSONEachRow {"x":4} {"y":5, "c":5} {"a":6, "b":6, "c":6};
SELECT * FROM test.defaults ORDER BY (x, y);
DROP TABLE IF EXISTS test.defaults;
ALTER TABLE test.defaults ADD COLUMN n Nested(a UInt64, b String);
INSERT INTO test.defaults FORMAT JSONEachRow {"x":7, "y":7, "n.a":[1,2], "n.b":["a","b"]};
SELECT * FROM test.defaults WHERE x = 7 FORMAT JSONEachRow;
ALTER TABLE test.defaults ADD COLUMN n.c Array(UInt8) DEFAULT arrayMap(x -> 0, n.a) AFTER n.a;
INSERT INTO test.defaults FORMAT JSONEachRow {"x":8, "y":8, "n.a":[3,4], "n.b":["c","d"]};
INSERT INTO test.defaults FORMAT JSONEachRow {"x":9, "y":9};
SELECT * FROM test.defaults WHERE x > 7 ORDER BY x FORMAT JSONEachRow;
DROP TABLE test.defaults;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册