Delete Hive Table Partition Data: Quick Guide
To delete partitioned table data, you can follow these steps:
- Find the partition name of the table to be deleted.
- Change the structure of a table
For example, to delete partition data in a table named example_table where date=’2022-01-01′, you can use the following command:
ALTER TABLE example_table DROP IF EXISTS PARTITION (date='2022-01-01');
This will remove partition data in the table example_table where date is ‘2022-01-01’. If you want to delete data from multiple partitions, you can use a similar command to delete multiple partitions at once.