1

Facing a weird issue. Alter table command to drop partition works well for > or < or >= or <= signs but not for = check.

Working command:

ALTER TABLE XYZ DROP PARTITION(bizdate>'20231230');

Command that's not working and throwing an error stating that partition does not exist:

ALTER TABLE XYZ DROP PARTITION(bizdate='20231230');

When I do show partitions, I can see '20231230' partition.

Note: bizdate is a varchar(10)

leftjoin
  • 36,950
  • 8
  • 57
  • 116
Dasarathy D R
  • 335
  • 2
  • 7
  • 20

1 Answers1

0

Check the list of partition in the table:

SHOW PARTITIONS <table>;

Perhaps it tries dropping the partition. It seems that the data was removed at some point on HDFS but the hive tables metadata still thinks those partitions exist

 ALTER TABLE *tableName* drop if exists PARTITION(bizdate="20231230");

& Re-pair the broken table

msck repair table *table_name*;
Skanda Shastry
  • 182
  • 6
  • 17