msck repair table for custom partition names

msck repair table is used to add partitions that exist in HDFS but not in the hive metastore.

However, it expects the partitioned field name to be included in the folder structure:
year=2015
|
|_month=3
|
|_day=5

Notice the partition name prefixed with the partition. This is necessary. msck repair table wont work if you have data in the following directory structure:
2015
|
|_3
|
|_5

This is kind of a pain. The only solution is to use alter table add partition with location.

ALTER TABLE test ADD PARTITION (year=2015,month=03,day=05) location ‘hdfs:///cool/folder/with/data’;

 
36
Kudos
 
36
Kudos

Now read this

Few Thoughts about Learning

It is funny how we have so much information available to us but nobody teaches us how to learn. In college, I struggled with processing vast amounts of information. I would read an article/paper/concept and comprehend only some part of... Continue →