Я попробовал этот код, чтобы узнать, но я получил ошибку:
val keysWithValuesList = Array("1=2000", "2=1800", "2=3000", "3=2500", "4=1500")
val data = sc.parallelize(keysWithValuesList,2)
val kv = data.map(_.split("=")).map(v => (1, v(1).toInt))
val initialCount = kv.first._2
val maxi = (x: Int, y: Int) => if (x>y) x else y
val mini = (x: Int, y: Int) => if (x>y) y else x
val maxP = (p1: Int, p2: Int) => if (p1>p2) p1 else p2
val minP = (p1: Int, p2: Int) => if (p1>p2) p2 else p1
val max_min = kv.aggregateByKey(initialCount)((maxi,mini),(maxP,minP))
ошибка: -
command-2654386024166474:13: error: type mismatch;
found : ((Int, Int) => Int, (Int, Int) => Int)
required: (Int, Int) => Int
val max_min = kv.aggregateByKey(initialCount)((maxi,mini),(maxP,minP))
^
command-2654386024166474:13: error: type mismatch;
found : ((Int, Int) => Int, (Int, Int) => Int)
required: (Int, Int) => Int
val max_min = kv.aggregateByKey(initialCount)((maxi,mini),(maxP,minP))
Есть ли другой способ? Пожалуйста, предложите