我试图使用DDL在蜂巢错误嵌套JSON在蜂巢
{
"id": "0001",
"type": "donut",
"name": "Cake",
"ppu": 0.55,
"batters":
{
"batter":
[
{ "id": "1001", "type": "Regular" },
{ "id": "1002", "type": "Chocolate" },
{ "id": "1003", "type": "Blueberry" },
{ "id": "1004", "type": "Devil's Food" }
]
},
"topping":
[
{ "id": "5001", "type": "None" },
{ "id": "5002", "type": "Glazed" },
{ "id": "5005", "type": "Sugar" },
{ "id": "5007", "type": "Powdered Sugar" },
{ "id": "5006", "type": "Chocolate with Sprinkles" },
{ "id": "5003", "type": "Chocolate" },
{ "id": "5004", "type": "Maple" }
]
}
加载该JSON数据命令
ADD JAR /home/cloudera/Downloads/json-serde-1.3.6-SNAPSHOT-jar-with-dependencies.jar;
CREATE EXTERNAL TABLE format.json_serde (
`id` string,
`type` string,
`name` string,
`ppu` float,
batters` struct < `batter`:array < struct <`bid`:string, `btype`:string >>>,
`topping`:array < struct<`tid`:int, `ttype`:string>>
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe';
抛出我的错误
FAILED: ParseException line 7:11 cannot recognize input near ':' 'array' '<' in column type </b>
谢谢,当我试图查询它返回folllowing错误**无法用异常产生java.io.IOException:org.apache.hadoop .hive.serde2.SerDeException:org.codehaus.jackson.JsonParseException:意外的输入结束:OBJECT的预期关闭标记(来自:[Source:[email protected]; line:1,column:0]) at [Source:java.io.ByteArrayInputStream的@ 73304204; line:1,column:3] **如果您对输入数据进行了任何格式化,请让我知道 –
任何JSON文档都应该写入一行。我不知道任何知道如何处理多行文档的JSON SerDe。 –