简体   繁体   中英

Deleting partitions in impala dynamically

Impala allow to add partitions dynamically as following.

insert into table1 partition (part_col1="merged",part_col2,part_col3) 
select  col1,col2,col3,part_col2,part_col3 from table2 where 
col="SomeValue"

So it will add multiple partitions depending upon the results from the select query.But when it comes to dropping the partitions there does not seem to be equivalent. is there ? You have to explicitly specify partitions to be dropped.

alter table table1 drop 
partition(part_col1="A",part_col2="B",part_col3="C") 

I can not just say something like

alter table table1 drop partition(part_col1="A",part_col2,part_col3)

遗憾的是,不能像您在示例中指定的那样动态删除分区。

Dropping multiple partitions is possible with Impala 2.8+

The documentation states "In Impala 2.8 and higher, the expression for the partition clause with a DROP or SET operation can include comparison operators such as <, IN, or BETWEEN, and Boolean operators such as AND and OR."

For an example see https://stackoverflow.com/a/45550350/4202225 where the second Demo shows how to drop a range of partitions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM