查阅资料发现大家往表中添加数据多少有误,在此献上常用的导入方式
1.从本地系统向hive表添加数据 :
load data local inpath "filePath" into table 表名 ;
本质上执行一条: hdfs dfs -put 本地路径 hdfs对应数据表放置的路径(表加载路径下)
2.从hdfs向hive表添加数据:
load data inpath "hdfsFilePath" into table 表名 ;
本质上执行一条 hdfs dfs -mv hdfs想要加载的文件 hdfs对应数据表放置的路径(表加载路径下)
3. 通过insert overwrite给hive表中加载数据(桶表添加数据方式一)
inset overwrite table 表名 select * from 中间表 cluster by(分桶字段)
4. 通过insert into给hive表中加载数据(桶表添加数据方式二)
inset into table 表名 select * from 中间表 cluster by(分桶字段)