1with partition_list as(select order_date, count(distinct input__file__name) cnt from ordersgroup by order_date having cnt > 5)insert overwrite table orders partition (order_date)select * from orderswhere order_date in (select order_date from partition_list)