插入Clickhouse jsoneachrow嵌套
我有下表,
SET flatten_nested = 0;
CREATE TABLE test.hm
(
customDimensions Array(Nested(index Nullable(Int64), value Nullable(String)))
)
engine = Memory;
我想在以下查询中插入其中:
INSERT INTO test.hm FORMAT JSONEachRow {"customDimensions": [{"index": 1, "value": 2}]}
但是它失败了
代码:130,e.displayText()= db ::异常:数组不会以'[''trace :(阅读键customDimensions的值)开头:(在第1行1)(版本21.8.4.51(官方)构建))
如何将其修复并插入json
中flatten_nested = 0
具有多LVL嵌套层次结构?
I have the following table
SET flatten_nested = 0;
CREATE TABLE test.hm
(
customDimensions Array(Nested(index Nullable(Int64), value Nullable(String)))
)
engine = Memory;
I am trying to insert into it with the following query:
INSERT INTO test.hm FORMAT JSONEachRow {"customDimensions": [{"index": 1, "value": 2}]}
But it fails with
Code: 130, e.displayText() = DB::Exception: Array does not start with '[' character: (while reading the value of key customDimensions): (at row 1) (version 21.8.4.51 (official build))
How to fix it and insert JSON
into flatten_nested = 0
having multi lvl nested hierarchy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(嵌套因为它是二维数组吗
您确定
需要
阵列 ,值nullable(string)))
,您可以使用jsonextract
https://kb.altinity.com/altinity-kb-schema-design/altinity--kb-jsonasstring-and.-kb-jsonasstring-and.-mat--- json-parser/
https://kb.altinity.com/altinity-kb-queries-and-syntax/jsonextract-to-parse-parse-parse-many-atributes-attributes-attributes-at-a time/
or 或 htttps:htttps:htttps:// click lickhouse .com/docs/en/guides/developer/working-with-json/json-semi-structured/#json-object-type
Are you sure you need
Array(Nested
because it's two-dimensional array.you can use select to get understanding what JSONEachRow CH expectes
I guess you really need
Array(Tuple(index Nullable(Int64), value Nullable(String)))
And you can use JSONExtract
https://kb.altinity.com/altinity-kb-schema-design/altinity-kb-jsonasstring-and-mat.-view-as-json-parser/
https://kb.altinity.com/altinity-kb-queries-and-syntax/jsonextract-to-parse-many-attributes-at-a-time/
Or https://clickhouse.com/docs/en/guides/developer/working-with-json/json-semi-structured/#json-object-type