hive导入数据

替换分隔符为\0
sed -i 's/\t/\x1/g;s/;/\x1/g' test1.txt

gz压缩
gzip -r test1.txt 

查看文件
hdfs dfs -ls /hive/warehouse/ods_jungle_ad.db/table1/dt=2016-12-15 

导入文件
load data local inpath '/home/hadoop/test/hb/test1.txt.gz' 
into table table1
partition (dt = '2016-12-15')

 

 关键字[INTO]意思是追加到表,[OVERWRITE]意思是是覆盖原表里的数据。
 关键字[LOCAL]是指你加载文件的来源为本地文件,不写则为hdfs的文件。

你可能感兴趣的:(hive导入数据)