load csv file of gzip file into hive

2019-07-31 05:06发布

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条回答
我欲成王,谁敢阻挡
2楼-- · 2019-07-31 05:54

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 |
+---+
查看更多
登录 后发表回答