SparkSession
has a number of createDataFrame
methods that create a DataFrame
given an RDD
. I imagine one of these will work for your context.
For example:
def createDataFrame(rowRDD: RDD[Row], schema: StructType): DataFrame
Creates a DataFrame from an RDD containing Rows using the given schema.