вы можете использовать функцию сжатия, предоставленную в улье
set hive.support.quoted.identifiers=none;
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
with partition_list as
(
select date, count(distinct input__file__name) cnt from table_name
group by date having cnt > 0
)
insert overwrite table table_name partition (date)
select * from table_name
where date in (select date from partition_list)