I have a simple code:
test("0153") {
val c = Seq(1,8,4,2,7)
val max = (x:Int, y:Int)=> if (x > y) x else y
c.reduce(max)
}
It works fine. But, when I follow the same way to use Dataset.reduce
,
test("SparkSQLTest") {
def max(x: Int, y: Int) = if (x > y) x else y
val spark = SparkSession.builder().master("local").appName("SparkSQLTest").enableHiveSupport().getOrCreate()
val ds = spark.range(1, 100).map(_.toInt)
ds.reduce(max) //compiling error:Error:(20, 15) missing argument list for method max
}
Compiler complains that missing argument list for method max
, I don't what's going on here.