gpt4 book ai didi

Hive 分区恢复

转载 作者:行者123 更新时间:2023-12-02 23:28:19 24 4
gpt4 key购买 nike

如何以简单的方式恢复分区。这是场景:

  1. Have 'n' partitions on existing external table 't'
  2. Dropped table 't'
  3. Recreated table 't' // Note : same table but with excluding some column
  4. How to recover the 'n' partitions that existed for table 't' in step #1 ?

我可以通过编写一些脚本手动更改表以添加“n”分区。但这非常乏味。是否有内置的东西可以恢复这些分区?

最佳答案

当分区目录仍然存在于 HDFS 中时,只需运行以下命令:

MSCK REPAIR TABLE table_name;

它根据表目录中存在的内容将分区定义添加到元存储。

关于Hive 分区恢复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37452950/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com