I had a file which is the format of gzip consisting of csv file;I want to load the data into hive ? how can i do ?I create table with textfile and load in ,but cannot work ,Also set coedc ,buit also not work
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Make sure your file ends with .gz
Demo
(Done on a local file system)
bash
bash$ cat | gzip - >mytable/mydata.gz~
1
2
3
hive
create external table mytable (i int);
select * from mytable;
+--------+
| i |
+--------+
| (null) |
+--------+
bash
bash$ mv mytable/mydata.gz~ mytable/mydata.gz
hive
select * from mytable;
+---+
| i |
+---+
| 1 |
| 2 |
| 3 |
+---+