1
如何在子查询中有多个列的情况下定义别名。从下面的例子我想定义别名为dSpark数据框中的别名
例如输出AVG(高):
val d = c.select("date","high").groupBy("date").avg("high")
如何在子查询中有多个列的情况下定义别名。从下面的例子我想定义别名为dSpark数据框中的别名
例如输出AVG(高):
val d = c.select("date","high").groupBy("date").avg("high")
您可以使用withColumnRenamed
此:
val d = c
.select("date","high")
.groupBy("date")
.avg("high")
.withColumnRenamed("avg(high)", "Average High")
你能做到这(“日期”)。agg(avg(“高”)。别名(“avg_high”)) –