Thursday, 3 July 2014

Hive External Table Partition

Just create a table partitioned by the desired partition key, then execute insert overwrite table from the external table to the new partitioned table (setting hive.exec.dynamic.partition=true and hive.exec.dynamic.partition.mode=nonstrict).
If you insist on keeping the table partitioned externally you have to manually create the directories (1 directory per partition the name should be PARTION_KEY=VALUE) then use the MSCK REPAIR TABLE table_name;command
ALTER TABLE test
    ADD PARTITION (dt='2014-03-05')
    location 's3://test.com/2014-03-05'

No comments:

Post a Comment