I am trying to create RDD objects of class case. For instance,
I am trying to complete part of the previous example by specifying
case class Person(name: String, age: Int) // Create an RDD of Person objects and register it as a table. val people: RDD[Person] = sc.textFile("/user/root/people.txt").map(_.split(",")).map(p => Person(p(0), p(1).trim.toInt)) people.registerAsTable("people")
I get the following error:
<console>:28: error: not found: type RDD val people: RDD[Person] =sc.textFile("/user/root/people.txt").map(_.split(",")).map(p => Person(p(0), p(1).trim.toInt))
Any idea on what went wrong? Thanks in advance!
source share