Reputation: 363
I have a partitioned table Student
which already has one partition column dept
. I need to add new partition column gender
Will it be possible to add this new partition column in already partitioned hive table.
The table data does not have gender
column. It is a new constant column to be added in hive table.
Upvotes: 0
Views: 395
Reputation: 38290
Partitions are hierarchical folders like table_location/dept=Accounting/gender=male/
Folder structure should exist. You can easily add non-partition column as the last one and it will return NULLs if the data does not contain that column, but to add a partition column the easiest way is to create new table partitioned as you want, insert overwrite that table from the old one (selecting partitions columns as the last ones), drop old table, rename new one.
See this answer about dynamic partitions load: https://stackoverflow.com/a/48901871/2700344
Upvotes: 1