Hi all, I have the following case class that I want to use as a key in a key-value rdd. I defined the equals and hashCode methode but it's not working. What I'm doing wrong ?
*case class PersonID(id: String) {* * override def hashCode = id.hashCode* * override def equals(other: Any) = other match {* * case that: PersonID => this.id <http://this.id> == that.id <http://that.id> && this.getClass == that.getClass* * case _ => false* * } * * } * * val p = sc.parallelize((1 until 10).map(x => (PersonID("1"),x )))* *p.groupByKey.collect foreach println* *(PersonID(1),CompactBuffer(5))* *(PersonID(1),CompactBuffer(6))* *(PersonID(1),CompactBuffer(7))* *(PersonID(1),CompactBuffer(8, 9))* *(PersonID(1),CompactBuffer(1))* *(PersonID(1),CompactBuffer(2))* *(PersonID(1),CompactBuffer(3))* *(PersonID(1),CompactBuffer(4))* Best, Jao