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/';
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