How to recover partitions in easy fashion. Here is the scenario :
- 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 ?
I can manually alter table to add 'n' partition by writing some script. But that's very tedious. Is there something built-in to recover these partitions ?
When the partitions directories still exist in the HDFS, simply run this command:
MSCK REPAIR TABLE table_name;
It adds the partitions definitions to the metastore based on what exists in the table directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With