Add a dynamic partiton in in a static partition in a nested partition table?

46 Views Asked by At

I have a table that has nested partitions like -

  • country1
    • run date 1
    • run date 2
  • country2
    • run date 1
    • run date 2

I need to add the first layer(country) statically (as they are in different locations) but want the 2nd layer(run dates) to be added dynamically.

I have tried below but its not working-

ALTER TABLE <table_name> ADD PARTITION (country=country1 , run_date) LOCATION '<path>';

1

There are 1 best solutions below

0
Raid On

I don't think there is dynamic partition option in alter table for hive.

However what I understand from your requirement may be something like below.

insert into nested_part partition(country='count1',run_date) select name,id,run_date from source4_nesting where country='count1';