GraphX-Spark:错误 graph.vertices.filter

GraphX-Spark: error graph.vertices.filter

我是 scala 和 spark-graphx 的新手。 这是我编写的用于提取具有最小分值的顶点的方法

def getMinScoreVertex(graph: Graph[(Int,Float,Float,Float,String),Float]):Float={
var minValue:Float=Float.PositiveInfinity
var LowestScoreValue=graph.vertices.filter { case (id,(_,_,_,Score,_)) => Score < minValue}
 return LowestScoreValue  }

我收到以下错误:

Error:(15, 62) constructor cannot be instantiated to expected type;
 found   : (T1, T2, T3, T4, T5)
 required: (org.apache.spark.graphx.VertexId, (Int, Float, Float, Float, String))
    (which expands to)  (Long, (Int, Float, Float, Float, String))
    var LowestScoreValue=graph.vertices.filter { case (_,_,_,Score,_) => Score < minValue}
Error:(15, 69) not found: value Score
    var LowestScoreValue=graph.vertices.filter { case (_,_,_,Score,_) => Score < minValue}
Error:(15, 82) not found: value Score
    var LowestScoreValue=graph.vertices.filter { case (_,_,_,Score,_) => Score < minValue}

有什么想法吗?? 谢谢

表扬时我错了,以为Score就是type。大多数时候,如果您进行模式匹配,使用小写字母是安全的。 (lowercased variables in pattern matching)

val filterResult = graph.vertices.filter {
    case (_, (_, _, _, score, _)) => score < minValue
}

这样不会报编译错误

还有一件事是 filter 不是 select 最小选择的正确选择。它只会过滤得分低于 minValue 的 VertexRDD,并将 return 列出。