I am new to Scala. I know the error is something related to Tuple1, Tuple2 initialization but not able to quite grab the exact reason.
Here is the syntax error message I am getting: type mismatch; found : ((Long, Long), Long) required: (((Long, Long), Long)) ⇒ String
and here is the code snippet causing it.
dedupedRDD = iterateRDD.mapPartitions(p => {
var minVal = 0L
p.map {
val tpl = p.next()
val key = tpl._1._1
val value = tpl._2
var outputTuple : Tuple2[Tuple2[Long, Long],Long] = null
if(key != prevKey){
if(value < key){
minVal = value;
outputTuple = ((minVal, key) , key)
newEdgeCounter.add(1L);
}else{
minVal = key;
outputTuple = ((minVal,value), value)
}
}else{
outputTuple = ((minVal, value), value)
}
prevKey = key;
outputTuple
}
})
How do I create output tuples of (((Long, Long), Long)). Any help will be greatly appreciated. Thanks.