In pandas, if we have a time series and need to group it by a certain frequency (say, every two weeks), it's possible to use the Grouper class, like this:
import pandas as pd
df.groupby(pd.Grouper(key='timestamp', freq='2W'))
Is there any equivalent in Spark (more specifically, using Scala) for this feature?