1
我正在使用配置单元,我需要以json格式添加数据。我使用https://github.com/rcongiu/Hive-JSON-Serde库。它从文件加载配置单元中的数据。使用Hive-JSON-SerDe添加数据查询
~$ cat test.json
{"text":"foo","number":123}
{"text":"bar","number":345}
$ hadoop fs -put -f test.json /user/data/test.json
$ hive
hive> CREATE DATABASE test;
hive> CREATE EXTERNAL TABLE test (text string)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
LOCATION '/user/data';
hive> SELECT * FROM test;
OK
foo 123
bar 345
但我需要加载的数据来自查询,如:
insert into table test values {"text": "abc", number: 666}
谁知道如何做到这一点?