I have 2 RDDs.
RDD1: ((String, String), Int)
RDD2: (String, Int)
For example:
RDD1
((A, X), 1)
((B, X), 2)
((A, Y), 2)
((C, Y), 3)
RDD2
(A, 6)
(B, 7)
(C, 8)
Output Expected
((A, X), 6)
((B, X), 14)
((A, Y), 12)
((C, Y), 24)
In RDD1, (String, String) combination is unique and in RDD2, every string key is unique. The score of A from RDD2 (6) gets multiplied with all the score values of entries that have A in its key in RDD1.
14 = 7 * 2
12 = 6 * 2
24 = 8 * 3
I wrote the following but gives me an error on case:
val finalRdd = countRdd.join(countfileRdd).map(case (k, (ls, rs)) => (k, (ls * rs)))
Can someone help me out on this ?
(A, X),6should be(A, X),12following your logic, or did I miss something? - maasg