I have a spark dataFrame and I want to aggregate values by multiple keys
As spark documentation suggests:
def groupBy(col1: String, cols: String*): GroupedData Groups the DataFrame using the specified columns, so we can run aggregation on them
So I do the following
val keys = Seq("a", "b", "c")
dataframe.groupBy(keys:_*).agg(...)
Intellij Idea throws me following errors:
- expansion for non repeated parameters
- Type mismatch: expected Seq[Column], actual Seq[String]
However, I can pass multiple arguments manually without errors:
dataframe.groupBy("a", "b", "c").agg(...)
So, my question is: How can I do this programmatically?