I have the following Scala code:
case class MyClass (
val id:Long, val age:Long, val name:String
)
val original = sqlc.sql(sqlStatement).rdd.map(row =>
{
MyClass(row.getLong(2),row.getLong(1),row.getString(0))
})
println(original.subtract(original).count())
The subtract operation never returns 0; it always returns the number of items in original. I understand that in Scala, the subtract operation doesn't work on mutable types; however, I thought case classes were supposed to be immutable.