Hive中刪除部分資料

2021-10-04 02:21:37 字數 705 閱讀 2343

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

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

1. 刪除具體partition

alter

table table_name drop

partition

(partiton_name=

'value'

))

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

(dt=

'v3'

)select column1,column2 from alpha_sales_staff_info

where dt=

'v3'

and category is

notnull

;

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

insert overwrite table dpc_test select

*from dpc_test where age is

notnull

;

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...