如何以简单的方式恢复分区。这是场景:
- Have 'n' partitions on existing external table 't'
- Dropped table 't'
- Recreated table 't' // Note : same table but with excluding some column
- 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/