You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Manickam P <ma...@outlook.com> on 2013/07/18 11:45:57 UTC

Hive - Alter column datatype

Hi experts,
I have created a table in hive and loaded the data into it. now i want to change the datatype of one particular column. Do i need to drop and move the file again to hive?will it work fine if i just alter the data type alone in hive? 


Thanks,Manickam P 		 	   		  

Re: Hive - Alter column datatype

Posted by Jonathan Medwig <jo...@gmail.com>.
Changing the datatype of a column will *not* alter the column's data 
itself - just Hive's metadata for that table. To modify the type of 
existing data:

1. Create a new table with the desired structure
2. Copy the existing table into the new table - applying any necessary 
type casting
3. Drop the old table and rename the new one to the old one's name

See more info here -
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-ChangeColumnName%2FType%2FPosition%2FComment

Jon

On 7/18/13 2:45 AM, Manickam P wrote:
> Hi experts,
>
> I have created a table in hive and loaded the data into it. now i want 
> to change the datatype of one particular column.
> Do i need to drop and move the file again to hive?
> will it work fine if i just alter the data type alone in hive?
>
>
>
> Thanks,
> Manickam P


Re: Hive - Alter column datatype

Posted by Stephen Sprague <sp...@gmail.com>.
let's put it this way.  what makes you ask the question that altering the
datatype wouldn't work?   After all that's why it's there. :)


On Thu, Jul 18, 2013 at 2:45 AM, Manickam P <ma...@outlook.com> wrote:

> Hi experts,
>
> I have created a table in hive and loaded the data into it. now i want to
> change the datatype of one particular column.
> Do i need to drop and move the file again to hive?
> will it work fine if i just alter the data type alone in hive?
>
>
>
> Thanks,
> Manickam P
>