I am trying to de duplicate a table that may have duplicates across partitions. For example
id device_id os country unix_time app_id dt
2 2 3a UK 7 5 2019-12-22
1 2 3a USA 4 5 2019-12-22
1 2 3a USA 4 5 2019-12-23
1 2 3a USA 4 5 2019-12-24
It can be seen that the table has similar column values apart from the 'dt' which is the partition column. I want to de duplicate such a table where similar records in older partitions will be dropped leaving the record in the newest partition. For example, the table above should look like the table below after deduplication.
id device_id os country unix_time app_id dt
2 2 3a UK 7 5 2019-12-22
1 2 3a USA 4 5 2019-12-24