【发布时间】:2018-03-06 09:32:40
【问题描述】:
我有一个包含 JSON 格式列的 hbase 表。所以,我想创建一个包含 struct> 类型的 hive 外部表。
名为 smms 的 Hbase 表:
colum name : nodeid , value : "4545781751" in STRING FORMAT
column name : events in JSON FORMAT
value : [{"id":12542, "status" :"true", ..},{"id":"1477", "status":"false", ..}]
Hive 外部表:
Create external table msg (
key INT
nodeid STRING,
events STRUCT<ARRAY<id:INT, status: STRING>
}
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,data:nodeid, data:events") TBLPROPERTIES ("hbase.table.name" = "smms");
hive 查询:select * from msg; 返回以下结果:
nodeid : 4545781751
events : NULL
谢谢
【问题讨论】: