val aggCols = List("Pclass","Age","Fare")
.map(colName=>functions.avg(colName).as("avg_"+colName))
df.groupBy("Survived").agg(aggCols.head,aggCols.tail:_*).show()
标签:Fare,map,functions,colName,aggCols,spark,avg,dstaframe,多字段
来源: https://www.cnblogs.com/zhouyc/p/15024410.html