为甚会为null 呢?
注意两点:
建表的时候:
这种建表方式 要求文件的数据格式 是 按照一个 tabe 键进行分割。
建表语句分隔符是’\t’,'\t’代表的是tab符号。
create table snapshot(
id bigint,
high_price double,
low_price double,
open_price double
)row format delimited fields terminated by '\t';
准备数据的格式样式为:
1 51.55 55.51 51.34
2 52.55 55.53 53.31
3 53.55 55.54 54.33
4 54.55 55.55 55.34
5 55.55 55.56 45.36
5 56.55 55.56 55.37
7 57.55 55.53 65.37
8 59.57 55.52 75.33
9 59.53 55.51 85.35
10 59.54 55.59 85.34
然后执行命令 即可。
load data local inpath '/usr/local/work/hive/data_file/snapshot.txt' into table snapshot;