hive 建表(Location, serde)

本文介绍如何在Hive中创建表,并指定Location为HDFS的/usr目录,同时利用CSVSerde处理CSV数据。此外,还讨论了自定义InputFormat和OutputFormat,以`com.jd.cloud.clickstore.ClickstreamInputFormat`作为输入格式,`org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat`作为输出格式,示例中将/data/clickstream_20110216.txt文件加载到clickstream_table表中。
摘要由CSDN通过智能技术生成
1) Location 关键字的使用
hadoop fs -put /usr/local/ae/1.txt /usr/
create table test_location(id int, name string) row format delimited fields terminated by '\t' stored as textfile location '/usr/';    // 此时1.txt中的数据已经加载到test_location表中了;
select * from test_location; // 会查询出test_location中对应到1.txt中的数据
2) 自定义serde的使用
hadoop fs -put /usr/1.csv /usr/
add jar xxxxxxx.jar;
create table test_serde_csv(a string, b string) row format serde 'com.bizo.hive.serde.csv.CSVSerde' stored as textfile location '/usr/'; 

会把hdfs /usr目录下的文件加载到test_serde_csv 表中,加载方式是通过CSVSerde类来实现的;

3) 自定义inputformat 和 outputformat

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值