将gzip文件的csv文件加载到配置单元中 [英] load csv file of gzip file into hive

查看:126
本文介绍了将gzip文件的csv文件加载到配置单元中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件,它是由csv文件组成的gzip格式;我想将数据加载到配置单元中?我怎么办?我创建表与文本文件并加载,但不能工作,也设置coedc,buit也无法正常工作

解决方案

确保你的文件以 .gz






结尾Demo



(在本地文件系统上完成)



  bash $ cat | gzip  - > mytable / mydata.gz〜
1
2
3

hive

 创建外部表mytable(i int); 






  select *来自mytable; 






  + -------- + 
|我|
+ -------- +
| (null)|
+ -------- +

bash

  bash $ mv mytable / mydata.gz〜mytable / mydata.gz 



hive

  select * from mytable; 






  + --- + 
|我|
+ --- +
| 1 |
| 2 |
| 3 |
+ --- +


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

解决方案

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 |
+---+

这篇关于将gzip文件的csv文件加载到配置单元中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆