2

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)
Gopal Bairwa
  • 139
  • 1
  • 5

2 Answers2

0

Sadly No, there is no way to drop a partition dynamically as you specified in your example.

Rafael Larios
  • 192
  • 2
  • 10
  • ...but it works with Hive, cf. https://stackoverflow.com/questions/32093132/hive-drops-all-the-partitions-if-the-partition-column-name-is-not-correct >> generally speaking there are many ALTER sub-commands that Impala does not support. – Samson Scharfrichter Sep 11 '18 at 16:51
0

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