But if you want to let the side can also different attributes, is not easy, because the (S, T) the tuples can polymorphism, use (Long, BaseClass) can represent (Long, ttf_subclass), but the Edge [BaseClass] and Edge [ttf_subclass] is not same,,, so the last line of the following code will compile error, prompt RDD [] in the element type is not consistent,
Everyone is how to solve the similar demand?
Case class VertexAttr (XXXX) extends the Serializable {
}
The class VA (XXXXX) extends EdgeAttr (XXXXX) {
}
The class VB (XXXXX) extends EdgeAttr (XXXXX) {
}
Case class EdgeAttr (XXXXX) extends the Serializable {
}
The class EA (XXXXX) extends EdgeAttr (XXXX) {
}
The class EB (XXXXX) extends EdgeAttr (XXXX) {
}
Val vertexArray=Array (
(1 l, new VA (" XXXX ")),
(2 l, new VA (" XXXX ")),
(3 l, new VB (" XXXX "))
)
Val edgeArray=Array (
Edge (1 l, 2 l, new EA (" XXXX ")),
Edge (1 l, 3 l, new EB (" XXXX ")),
The Edge (2 l, 3 l, new EB (" XXXX "))
)
//structure vertexRDD and edgeRDD
Val vertexRDD: RDD. [(Long, VertexAttr)]=sc parallelize (vertexArray)
Val edgeRDD: RDD [Edge [EdgeAttr]]=sc. Parallelize (edgeArray)
CodePudding user response:
Excuse me, would you please tell me the problem you solve it? There is a problem, if the node the creation, then to filter on node shouldhow to match?