如何在使用 hdfs 将 orc 文件复制到 table 的文件夹后更新配置单元 table 的数据

How to update a hive table's data after copied orc files with hdfs into the folder of that table

在使用 hdfs 副本将 orc 文件插入 table 的文件夹后,如何更新该配置单元 table 的数据以在使用配置单元查询时查看这些数据。

此致。

如果table没有分区,那么一旦文件在LOCATION子句中指定的文件夹中的HDFS中,那么数据应该可用于查询。
如果 table 已分区,那么您首先需要 运行 一条 ADD PARTITION 语句。

正如 belostoky 在上面的回答中提到的。如果 table 没有分区那么你可以直接用更新后的数据查询你的 table 但是如果你 table 被分区,你需要先在配置单元 table 中添加分区,你可以使用

您可以使用 alter table 语句添加如下所示的分区

ALTER TABLE table1
    ADD PARTITION (dt='<date>')
    location '<hdfs file path>'

添加分区后,hive metastore 应该知道更改,因此您需要 运行

msck repair table table1 

在 Metastore 中添加分区。

完成后您可以查询您的数据