I have this type ;
column1 column2 int
((a,b),1)
((a,c),1)
((k,a),1)
I need two types results,firstly total of column1 for all column2
(a,total)
and secondly column1 parameter is not equal to column2 parameter
(a,total)
How can i use ReduceByKey For this type ?
my codes :
var data = sc.textFile("tttt.tsv")
var satir = data.map(line=> ((line.split("\t")(1).toString,line.split("\t")(2).toString),1))
---About Second Scenario
My data type example is
column1 column2 int
a b,1
a c,1
a a,1
a d,1
I need reduceByKey for column1 is not equal column1 in second scenario
for example,my example data result = (a,b,1) + (a,c,1)+(a,d,1) = 3