Hive的表属性操作
2015-07-18 18:05
253 查看
修改表名
alter table table_name rename to new_table_name
增加列
alter table tablename add columns(c1 string comment 'xxxx', c2 long comment 'yyyy')
修改列名
alter table tablename change column c_Old c_New int comment 'XXXXXX'
after severity;//可以把该列放到指定列的后而,或者使用’first’放到第一位。
修改表属性tblproperties
alter table tablename set tblproperties( property_name=property_value,property_name=property_value,… );
修改表属性serdeproperties
注意:针对无分区表与有分区表不同。无分区
alter table tablename set serdeproperties( 'field.delim'='\t' );
有分区
alter table tablename partition(dt='xxxx') set serdeproperties ('field.delim'='\t');
修改location
布置只有外部表可以指定location,内部表也可以指定location。alter table table_name [partition(...)] set location 'path'
验证:
select * from city;
删除表同样也会将指定位置的文件目录删除。
内部表转外部表
alter table tablename set TBLPROPERTIES ('EXTERNAL' = 'TRUE');
外部表转内部表
alter table table_name set TBLPROPERTIES('EXTERNAL'='FALSE');
相关文章推荐
- HDU 4866 Shooting
- mac svn命令 linux同样适用
- 堆排序-java
- java函数
- 企业服务总线架构介绍
- 【Linux&Unix--文件描述叙事的性格和权柄】
- shell中$0,$?,$!等的特殊用法
- hdu Is It A Tree?
- css中设置图片的显示与隐藏
- function, new function, new Function之间的区别
- CSS 扩展技术
- 详细解读CSS中的伪类after
- linux源码,list_entry阅读心得
- imadjust
- android 如何添加一种新的语言
- Codeforces Round #240 (Div. 2) (ABCDE题解)
- 我的人生和我的程序
- Servlet中Web.xml的配置详解
- 选用神经网络还是支持向量机
- 安装禅道