5
Tôi đang cố tạo một RDD của các đối tượng lớp vỏ. . Ví dụ,lỗi spark RDD không tìm thấy khi tạo RDD
// sqlContext from the previous example is used in this example.
// createSchemaRDD is used to implicitly convert an RDD to a SchemaRDD.
import sqlContext.createSchemaRDD
val people: RDD[Person] = ... // An RDD of case class objects, from the previous example.
// The RDD is implicitly converted to a SchemaRDD by createSchemaRDD, allowing it to be stored using Parquet.
people.saveAsParquetFile("people.parquet")
tôi đang cố gắng để hoàn thành phần từ ví dụ trước bằng cách cho
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")
tôi nhận được lỗi sau:
<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))
Bất kỳ ý tưởng về những gì đã xảy ra? Cảm ơn bạn trước!
Cảm ơn rất nhiều, Josh. – user1189851