第16天: 增加分区、删除分析、加载数据到指定分区讲解和案例操作

Hive学习实战   
--------------------------------------------------------------
Hive从入门到实战【40讲】---笔记记录
--------------------------------------------------------------
 
hive命令
1、show tables;
2、show databases;
3、 desc login; ---查看表结构。
4、 show partitions test5; --查看分区


第16天: 增加分区、删除分析、加载数据到指定分区讲解和案例操作---


添加分区
alter table table_name
add partiton( partCol='value1' ) location 'loc1';


删除分区
alter table login drop if exists partition (dt='2008-08-08');
alert table page_view drop if exists partition(dt=2008-08-08
',country='us');


添加列
alter table table_name add columns (
col_name string); //在所有存在的列后面,但是
在分区列之前添加一列。




create table test5(
 uid  string,
 ip string
)
partitioned by (dt string,hour string)
row   format  delimited
fields terminated by ','
stored as  textfile;


alter table test5 
add  partition (dt='2015-02-08',hour='08')
location '/hive/test5/dt=2015-02-08/hour=09'


 partition (dt='2015-02-08',hour='09')
location '/hive/test5/dt=2015-02-08/hour=10'


 


load data local inpath '/hadoop/hive0.9/testHive/x1.txt'  into  table test5 
 partition(dt='2015-02-08',hour='09')
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值