예제 #1
0
 def innerJoin(self):
     vertexData0 = self.sc.parallelize([(3, ("rxin", "student")), (7, ("jgonzal", "postdoc"))])
     vertexData1 = self.sc.parallelize([(1, ("rxin", "student")), (2, ("jgonzal", "postdoc"))])
     vertices0 = VertexRDD(vertexData0)
     vertices1 = VertexRDD(vertexData1)
     results = vertices0.innerJoin(vertices1).collect()
     self.assertEqual(results, [])
예제 #2
0
 def leftJoin(self):
     vertexData0 = self.sc.parallelize([(3, ("rxin", "student")), (7, ("jgonzal", "postdoc"))])
     vertexData1 = self.sc.parallelize([(1, ("rxin", "student")), (2, ("jgonzal", "postdoc"))])
     vertices0 = VertexRDD(vertexData0)
     vertices1 = VertexRDD(vertexData1)
     results = vertices0.diff(vertices1)
     self.assertEqual(results, 2)
예제 #3
0
 def collect(self):
     vertexData = self.sc.parallelize([(3, ("rxin", "student")), (7, ("jgonzal", "postdoc"))])
     vertices = VertexRDD(vertexData)
     results = vertices.collect()
     self.assertEqual(results, [(3, ("rxin", "student")), (7, ("jgonzal", "postdoc"))])
예제 #4
0
 def mapValues(self):
     vertexData = self.sc.parallelize([(3, ("rxin", "student")), (7, ("jgonzal", "postdoc"))])
     vertices = VertexRDD(vertexData)
     results = vertices.mapValues(lambda x: x + ":" + x)
     self.assertEqual(results, [(3, ("rxin:rxin", "student:student")),
                                (7, ("jgonzal:jgonzal", "postdoc:postdoc"))])