查阅资料发现大家往表中添加数据多少有误,在此献上常用的导入方式
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(分桶字段)
本文详细介绍四种常用的数据加载方式到Hive表中,包括从本地系统、HDFS加载数据,以及通过INSERT OVERWRITE和INSERT INTO给桶表加载数据的方法。每种方式都附有具体操作命令,为Hive用户提供了实用的指南。
484

被折叠的 条评论
为什么被折叠?



