lib*_*ack 52
您可以将文本文件加载到文本文件Hive表中,然后将此表中的数据插入到序列文件中.
从制表符分隔文件开始:
% cat /tmp/input.txt
a b
a2 b2
Run Code Online (Sandbox Code Playgroud)
创建一个序列文件
hive> create table test_sq(k string, v string) stored as sequencefile;
Run Code Online (Sandbox Code Playgroud)
尝试加载; 正如预期的那样,这将失败:
hive> load data local inpath '/tmp/input.txt' into table test_sq;
Run Code Online (Sandbox Code Playgroud)
但是用这张桌子:
hive> create table test_t(k string, v string) row format delimited fields terminated by '\t' stored as textfile;
Run Code Online (Sandbox Code Playgroud)
负载工作得很好:
hive> load data local inpath '/tmp/input.txt' into table test_t;
OK
hive> select * from test_t;
OK
a b
a2 b2
Run Code Online (Sandbox Code Playgroud)
现在从文本表加载到序列表中:
insert into table test_sq select * from test_t;
Run Code Online (Sandbox Code Playgroud)
也可以使用覆盖来加载/插入以替换所有.
| 归档时间: |
|
| 查看次数: |
122597 次 |
| 最近记录: |