hive 基本操作

1. 删除partition

ALTER TABLE crdholder_addr_log DROP IF EXISTS PARTITION (ts>='2017-03-25'); 

2. 修改表名称

ALTER TABLE cnswcpos.sams_dly_inventory_tmp RENAME TO cnswcpos.sams_dly_inventory;

3. 清空表数据;

 truncate table crdholder_addr_log;

 

4.从hive导出数据到文本

###导出到本地
insert overwrite local directory '/home/hadoop/mongo_stores' row format delimited fields terminated by '\t' select * from mongo_stores;

###导出到hdfs
insert overwrite directory '/user/hadoop/mongo_stores' row format delimited fields terminated by '\t' select * from mongo_stores;

 

5.创建自定义函数

add jar hdfs://ns1/jar/hive/HiveEncryption.jar;
create TEMPORARY function hive_encrypt as 'com.yikesz.bigdata.hive.Encrypt';

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*