convert RDD to Dataset in Java Spark
.createDataset()
accepts RDD<T>
not JavaRDD<T>
. JavaRDD
is a wrapper around RDD inorder to make calls from java code easier. It contains RDD internally and can be accessed using .rdd()
. The following can create a Dataset
:
Dataset<Person> personDS = sqlContext.createDataset(personRDD.rdd(), Encoders.bean(Person.class));