hive—load数据总结
(2014-09-01 16:07:33)
标签:
股票 |
1. hive load数据为null:
错误示例:
hive> create table
user_info(uid string, name string)
partitioned by(dt string, level string);
hive> load data local
inpath '/home/test/test_20140901.txt'
overwrite into table
user_info
partition(dt='20140929',
level=10)";
错误结果:
导入数据全为NULL
正确示例:
hive> create table
user_info(uid string, name string)
partitioned by(dt string, level string)
row
format delimited fields terminated by '\t';
hive> create
external table user_info(uid string, name
string)
partitioned by(dt string, level string)
row
format delimited fields terminated by '\t'
location
'/home/liufang/liu.txt';
load data
hive> load data local inpath
'/home/test/test_20140901.txt'
overwrite
into table user_info
partition(dt='20140929', level=10)";
insert data
hive>insert
overwrite table table_1
partition(dt='20141102')
select
uid, name, email where dt='20141102';
备注:hive默认分隔符"\001",所以建表一定要指定分割符为"\t"。
参考文献:
前一篇:rsync—linux数据传输
后一篇:cron+hive初学易忽略细节