hive分割槽表刪除部分資料

2021-09-26 21:21:23 字數 681 閱讀 9832

1、hive表刪除資料不能使用delete from table_name 的sql語句

2、hive表刪除資料要分為不同的粒度:table、partition

一、有partition表

刪除具體partition

alter table table_name drop partition(partiton_name=『value』))

2. 刪除partition內的部分資訊(insert overwrite table)

(這裡也可以將資料複製到其他表再篩選匯入)

insert overwrite table table_name partition(ds=『2019-09-05』)

select column1,column2 from alpha_sales_staff_info

where ds=『2019-09-05』 and dt=『2019-09-05』;

注:如果這裡寫select*from便會報錯,分割槽ds雖然顯示但它不屬於表分割槽後可插的資料

重新把對應的partition資訊寫一遍,通過where 來限定需要留下的資訊,沒有留下的資訊就被刪除了。

二、無partiton表

insert overwrite table dpc_test select * from tbl_test where age is not null;

Hive表刪除表部分資料

1 hive表刪除資料不能使用deletefrom table name 中sql語句 2 hive表刪除資料要分為不同的粒度 table partition partition內 alter table table name drop partition partiton name value i...

hive表如何刪除部分資料

hive 表刪除部分資料不支援使用 delete from table name where 語句 hive表刪除資料要分為不同的粒度 table partition partition內 有分割槽欄位的資料表,刪除資料時要注意分兩種情況 1 根據分割槽刪除資料,可以刪除滿足條件的分割槽,具體 格式...

hive刪除表中部分資料

insert overwrite table table name select from table name where 可以看出,刪除的本質就是覆蓋,選出符合條件的結果重新寫表。1 刪除某個分割槽 alter table table name drop partition dt 2020 09...