首页 文章

在分区表上的 Hive alter 语句

提问于
浏览
2

我在 Hive 中有一个空的分区表,我正在尝试为表中的列以及列的顺序命名:

> describe formatted test_hive;

col_name data_type 评论

col1 日期 col2 字符串 col3 字符串 abc decimal(11,2)

分区信息

col_name data_type 评论

mth_year 字串

尝试将 abc 重命名为 xyz 并将其移动到 col1 之后,但是当我运行时

alter table test_hive partition(mth_year)  CHANGE abc  xyz DECIMAL(11,2) AFTER col1;

但出现错误:

FAILED: SemanticException [Error 10006]: Partition not found {proc_mth_year=null}

我们可以在空的分区表上进行更改吗?

1 回答

  • 1

    您必须注意特定的分区 e.g. --

    alter table test_hive partition (mth_year='03_2017') 
    change abc xyz decimal(11,2) after col1
    ;
    

    或在表格级别执行-

    alter table test_hive
    change abc xyz decimal(11,2) after col1
    cascade
    ;
    

相关问题