Hive Alter table change Column Name

前端 未结 3 1759
庸人自扰
庸人自扰 2020-12-23 21:00

I am trying to rename a columnName in Hive. Is there a way to rename column name in Hive .

tableA (column1 ,_c1,_c2) to tableA(column1,column2,column3) ??

3条回答
  •  不思量自难忘°
    2020-12-23 22:01

    alter table table_name change old_col_name new_col_name new_col_type;
    

    Here is the example

    hive> alter table test change userVisit userVisit2 STRING;      
        OK
        Time taken: 0.26 seconds
        hive> describe test;                                      
        OK
        uservisit2              string                                      
        category                string                                      
        uuid                    string                                      
        Time taken: 0.213 seconds, Fetched: 3 row(s)
    

提交回复
热议问题