Support Questions

Find answers, ask questions, and share your expertise

How to drop all the sub-partitions of a certain partition on Impala?


Hello , I'm using Impala 5.9  and I would like to drop the sub-partitions of a certain partition.

For example I have a table with 2 partitioned columns, Year & Month.

So If I want to drop all the months of a certain Year I have to run the following command 12 times

ALTER TABLE  schema.Table DROP IF EXISTS PARTITION (year=2018, month='...') 


When I  run sth like that :

ALTER TABLE  schema.Table DROP IF EXISTS PARTITION (year=2018) in order to drop all the sub-partitions  at once It gives me the following error:

<< Items in partition spec must exactly match the partition columns in the table definition: schema.Table (1 vs 2) >>


Can you suggest me a way to run one command and drop many partitions at once ?




Hi @eMazarakis,

Prior IMPALA-1654 the AlterTableDropPartitionStmt was working with PartitionSpec which is a collection of partition key/values. While from Impala 2.8+ and CDH 5.10+ IMPALA-1654 is available and the AlterTableDropPartitionStmt uses PartitionSet which can be a partition expression as well.

In CDH 5.9 and earlier the partitions have to be specified manually in the ALTER TABLE DROP PARTITION statement.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.