我正在尝试运行以下代码,编译器当前被卡住。。。我怀疑这与标题中提到的块有关,因为当我评论一个块时,它正常工作,但没有预期的结果
def convertSize(size: String): Double = {
if (size.contains('M')) {
size.dropRight(1).toDouble
}
else {
size.toDouble / 1000000
}
}
val sizeUDF = udf(convertSize _);
spark.read
.option("header", "true")
.option("mode", "DROPMALFORMED")
//.schema(Gps.schema)
.csv(Gps.path)
.groupBy(col("App"),
col("Rating"),
col("Reviews"),
col("Size")
col("Installs"),
col("Type"),
col("Price"), //todo convert
col("Content Rating"),
col("Genres"), //todo split
col("Last Updated"), //todo convert
col("Current Ver").alias("Current_Version"),
col("Android Ver").alias("Minimum_Android_Version")
)
.agg(collect_set("Category").alias("Categories"))
.withColumn("Size", sizeUDF($"Size"))
.show()
暂无答案!
目前还没有任何答案,快来回答吧!