Updated on 2024-12-13 GMT+08:00

Drop Partition

This section applies only to MRS 3.50-LTS or later.

Function

This command is used to delete a single partition or multiple partitions.

Syntax

alter table $tableName drop partition (Partitioning field= 'Match condition')

Example

// Delete a partition.
alter table $tableName drop partition (dt='2021-10-01')
// Delete partitions.
alter table $tableName drop partition (dt='2021-10-01', dt='2021-10-02')
// Fuzzy match to delete multiple partitions.
alter table $tableName drop partition (dt='2021-10-*') // Delete the partition of October.

Precautions

You can use fuzzy match to delete multiple partitions. Only asterisks (*) are supported. Complex regular expressions are not supported.

Response

You can view command execution results in the driver log or on the client.