表属性操作
- 修改表名
- alter table table_name rename to new_table_name;
- 修改列名
alter table tablename change column c1 c2 int comment ‘xxxx’;
after severity;//可以吧该列放到指定列的后面,或者使用‘first’放到第一位
alter table test change column type type string after name;
alter table test change column type type string first;
- 增加列
- alter table tablename add columns(c1 string comment ‘xxxx’,c2 long comment ‘yyyy’)
- 修改tblproperties
- alter table table_name set tblproperties(property_name = property_value,property_name= property_value,…)
- 针对无分区表与有分区表不同
- alter table table_name set serdeproperties (‘field.delim’ = ‘\t’)
- 有分区表
- alter table test1 partition(dt=’xx’) set serdeproperties(‘field.delim’=’\t’)
- 修改location
- alter table table_name [partition(…)] set location ‘path’
- alter table table_name set tblproperties(‘external’=’true’)//内部表转外部表
- alter table table_name set tblproperties(‘external’=’false’)//外部表转内部表
- …
- alter table properties
- alter serde properties
- alter table/partition file format
- alter table storage properties
- alter table rename partition
- alter talbe set location
- wiki LanguageManual DDL