加载hdfs的parquet文件到hive的分区表注意事项

加载hdfs的parquet文件到hive的分区表注意事项

加载hdfs的parquet文件到hive的分区表中时,数据加载不进去

问题场景描述

1、使用spark将文件以parquet格式写入到HDFS中的指定路径下hdfs://myserver:8020/user/hive/warehouse/wechat,然后使用
ALTER TABLE wechat SET LOCATION ‘hdfs://myserver:8020/user/hive/warehouse/wechat’ 加载文件到hive的wechat表中,但是表数据为空。

最后使用
alter table wechat add partition (year=2020,month=03,day=31) location ‘hdfs://myserver:8020/user/hive/warehouse/wechat’; 方式就可以将数据加载到分区表中。

注意

hive加载普通表和分区表使用的HQL语句不一样!!!!!

你可能感兴趣的:(加载hdfs的parquet文件到hive的分区表注意事项)