How can we pivot on more than one column in a dataframe. e.g. The example mentioned here, https://spark.apache.org/docs/latest/sql-ref-syntax-qry-select-pivot.html
SELECT * FROM person
PIVOT (
SUM(age) AS a, AVG(class) AS c
FOR (name, age) IN (('John', 30) AS c1, ('Mike', 40) AS c2)
);
Here Pivot is done on (name,age). We can't pass more than one parameter in Spark scala's pivot method as it only expects one column name as parameter. How can we do the similar operation for a dataframe?