Hi,
I am getting type mismatch error while union operation.
Can someone suggest solution ?
/ case class MyNumber(no: Int, secondVal: String) extends Serializable
with Ordered[MyNumber] {
override def toString(): String = this.no.toString + " " +
this.secondVal
override def compare(that: MyNumber): Int = this.no compare that.no
override def compareTo(that: MyNumber): Int = this.no compare that.no
def Equals(that: MyNumber): Boolean = {
(this.no == that.no) && (that match {
case MyNumber(n1, n2) => n1 == no && n2 == secondVal
case _ => false
})
}
}
val numbers = sc.parallelize(1 to 20, 10)
val firstRdd = numbers.map(new MyNumber(_, "A"))
val secondRDD = numbers.map(new MyNumber(_, "B"))
val numberRdd = firstRdd .union(secondRDD )
<console>:24: error: type mismatch;
found : org.apache.spark.rdd.RDD[MyNumber]
required: org.apache.spark.rdd.RDD[MyNumber]
val numberRdd = onenumberRdd.union(anotherRDD)/
--
View this message in context:
http://apache-spark-user-list.1001560.n3.nabble.com/error-type-mismatch-while-Union-tp13547.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]