嵌套json到Hive表

时间:2015-08-19 15:13:12

标签: json hadoop hive

我的json文件如下:

{VALUES:[{"UTAGID":"SYSTEM_CHILLER1","tagName":"P1","tagValue":"10","tagTime":"2015-07-23T14:29:30.731Z","tagQuality":"128"}'
...........}]};

我把json架构写成:

create table t1(VALUES array<<struct<UTAGID:STRING, tagName:STRING, tagValue:STRING, tagTime:STRING, tagQuality:STRING>>)

ROW FORMAT SERDE "org.apache.hadoop.hive.contrib.serde2.JsonSerde"

STORED AS TEXTFILE;

LOAD DATA LOCAL INPATH"/tmp/jsonstreaming.json"into table t1;

但是我仍然在ParseException缺失的情况下得到错误&lt;靠近struct关键字。 可能是什么原因?

1 个答案:

答案 0 :(得分:0)

我认为你有额外的<尝试

create table t1(VALUES array<struct<UTAGID:STRING, tagName:STRING, tagValue:STRING, tagTime:STRING, tagQuality:STRING>>)