Import did not work for me. The Eclipse IDE still detected a compilation error.
But the next method call worked
df.groupBy("Gender").agg(org.apache.spark.sql.functions.max(df.col("Id")), org.apache.spark.sql.functions.sum(df.col("Income")));
If aggregation includes only one field, we can also use the following syntax
df.groupBy("Gender").max("Income");
source
share