Consider 2 dataframes holiday df and everyday df with 3 columns as below
- Holiday df: (5 records)
Country_code|currency_code| date
Gb | gbp | 2022-04-15
Gb | gbp | 2022-04-16
US | usd | 2022-04-17
Gb | gbp | 2022-04-18
Gb | gbp | 2022-04-21
- Everyday df (4 records)
Country_code_demo|currency_code_demo| date_demo
Gb | gbp | 2022-04-14
Gb | gbp | 2022-04-15
Gb | gbp | 2022-04-16
Gb | gbp | 2022-04-18
with columns as country_code,currency_code and date columns. Date columns of both dataframes needs to be Compared based on country_code and currency_code. If date between both dataframes matches then everyday df:date_demo column needs to updated to next working day and the date should also not be present in the holiday df. Write a spark scala code using window functions. Expected output is as below
Country_code_demo|currency_code_demo| date_updated
Gb | gbp | 2022-04-14
Gb | gbp | 2022-04-17
Gb | gbp | 2022-04-17
Gb | gbp | 2022-04-19