Is there a way to get the most 30 recent days worth of records for each grouping of data in Pyspark? In this example, get the 2 records with the most recent dates within the groupings of (Grouping, Bucket). So a table like this
| Grouping | Bucket | Date |
|----------|--------|-----------|
| 1 | 1 | 9-20-2020 |
| 1 | 1 | 9-16-2020 |
| 1 | 1 | 8-14-2020 |
| 1 | 2 | 9-20-2020 |
| 1 | 2 | 9-16-2020 |
| 1 | 2 | 8-14-2020 |
| 2 | 1 | 9-20-2020 |
| 2 | 1 | 9-16-2020 |
| 2 | 1 | 8-14-2020 |
Would turn into this:
| Grouping | Bucket | Date |
|----------|--------|-----------|
| 1 | 1 | 9-20-2020 |
| 1 | 1 | 9-16-2020 |
| 1 | 2 | 9-20-2020 |
| 1 | 2 | 9-16-2020 |
| 2 | 1 | 9-20-2020 |
| 2 | 1 | 9-16-2020 |
Edit: I reviewed my question after edit and realized that not doing the edit to begin with was the right choice