测试环境如下
Impala版本:3.1.0+cdh6.1.0
Kudu版本:1.8.0+cdh6.1.0
操作步骤
1.将表从内部切换到外部
alter table old_table_name set tblproperties(‘EXTERNAL’=‘true’);
2.重命名表名
alter table old_table_name rename to new_table_name;
3.查看建表语句,此步骤不能省略,必须执行
show create table new_table_name;
4.在linux系统执行命令修改kudu表名(IP要修改为自己的IP地址)
kudu table rename_table IP:7051 impala::default.old_table_name impala::default.new_table_name
5.更改基础kudu表(只有外部表能修改)
alter table new_table_name set tblproperties(‘kudu.table_name’=‘impala::default.new_table_name’);
6.将表从外部切换到内部
alter table new_table_name set tblproperties(‘EXTERNAL’=‘false’);
7.验证
show create table new_table_name;
select * from new_table_name limit 5;
注意:
1.kudu table rename_table命令在linux执行,其他语句都在impala中执行
2.若有报错请仔细核对关键字是否正确
参考网址
https://docs.cloudera.com/documentation/enterprise/6/6.1/topics/impala_alter_table.html
如果对你有帮助请点赞支持,如果文中有错误或疑问请评论指正,谢谢。