Is it possible to change partition metadata in HIVE?

J Weezy

This is an extension of a previous question I asked: How to compare two columns with different data type groups

We are exploring the idea of changing the metadata on the table as opposed to performing a CAST operation on the data in SELECT statements. Changing the metadata in the MySQL metastore is easy enough. But, is it possible to have that metadata change applied to partitions (they are daily)? Otherwise, we might be stuck with current and future data being of type BIGINT while the historical is STRING.

Question: Is it possible to change partition meta data in HIVE? If yes, how?

Strick

You can not change the partition column in hive infact Hive does not support alterting of partitioning columns

Refer : altering partition column type in Hive

You can think of it this way - Hive stores the data by creating a folder in hdfs with partition column values - Since if you trying to alter the hive partition it means you are trying to change the whole directory structure and data of hive table which is not possible exp if you have partitioned on year this is how directory structure looks like

tab1/clientdata/2009/file2
tab1/clientdata/2010/file3

If you want to change the partition column you can perform below steps

  1. Create another hive table with required changes in partition column

    Create table new_table ( A int, B String.....)

  2. Load data from previous table

    Insert into new_table partition ( B ) select A,B from table Prev_table

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related