Hive 刪除行, 表 ,清空表

刪除行
A表數據以下
it

id(String)        name(String)io

----------------------------table

1                       aaaclass

2                       bbbdate

3                       cccselect

-----------------------------數據

要求刪除2        bbb腳本

hive 腳本以下:tab

insert overwrite table A select id,name from A where id !=2;di

 

TRUNCATE: truncate 用於刪除全部的行,這個行爲在 Hive 元存儲刪除數據是不可逆的

DROP: 刪除 hive 中的表

truncate 不能刪除外部表!由於外部表裏的數據並非存放在 Hive Meta store 中

truncate:

truncate table table_name;

例子:

truncate table employees;

 

Hive 1.x 版本中沒有 delete 操做

2.x 版本更新後支持,若是一個表要實現 update 和 delete 功能,該表就必須支持 ACID,而支持 ACID,就必須知足如下條件: 一、表的存儲格式必須是 ORC(STORED AS ORC);

二、表必須進行分桶

三、Table property 中參數 transactional 必須設定爲 True

相關文章
相關標籤/搜索