![](/img/trans.png)
[英][Spark][Scala][DataFrame][withColumn] cannot resolve symbol “when” when using “when” in WithColumn
[英]Cannot Resolve Symbol When Trying to Using Spark Aggregation Function
你的导入语句应该是import org.apache.spark.sql.functions._
其中._
是通配符导入。 org.apache.spark.sql.functions
对象定义了要使用的内置标准函数。
然后你可以使用这样的功能:
df.groupBy(df("pt")).agg(max("id"), mean("encodedType")).show
您可以在此链接中查看示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.