1
我有3個RDD類似的分區鍵(假設爲idOwner一個String):
JavaPairRDD<PartitionKey, Iterable<Cat>> rddCat
JavaPairRDD<PartitionKey, Iterable<Dog>> rddDog
JavaPairRDD<PartitionKey, Iterable<Fish>> rddFish
如何去預期的解決方案:
JavaPairRDD<PartitionKey, Tuple3<Iterable<Cat>, Iterable<Dog>, Iterable<fish>>>
我只能勉強做到這一點,如何將三個RDD組合在一起?
失敗1:
rddCat.cogroup(rddDog, rddFish)
--> FlatMapFunction<Tuple2<PartitionKey, Tuple3<Iterable<Iterable<Cat>>, Iterable<Iterable<Dog>>, Iterable<Iterable<Fish>>>>
故障2:
JavaPairRDD<PartitionKey, Tuple2<Iterable<Cat>, Iterable<Dog>>> catDogRdd = rddCat.join(rddDog);
JavaPairRDD<PartitionKey, Tuple2<Tuple2<Iterable<Cat>, Iterable<Dog>>, Iterable<Fish>>> finalRdd = catDogRdd.join(rddFish);
謝謝你,但是如果我使用我加盟只能管理有:'JavaPairRDD,可迭代 >> catDogRdd = rddCat.join(rddDog);'然後'JavaPairRDD ,Iterable >,Iterable >> finalRdd = catDogRdd.join(rddFish);' –
Fundhor
看起來不錯,有什麼問題? – Reactormonk
@Reactormonk我期望tuple3,而不是tuple2在antoher tuple2中 – Fundhor