Say, I have : case class Rows(column: String,operation: String,result: String) I created a array buffer and stored objects of type Rows in it. How to convert this into a dataframe
Asked
Active
Viewed 86 times
0
-
Welcome to SO. Here are some references to help you ask questions on SO -- [ask], [mcve], [How to make good reproducible Apache Spark examples](https://stackoverflow.com/q/48427185/8279585) – samkart Jun 14 '22 at 09:48
1 Answers
0
Given a case class definition and a spark session you could use createDataFrame
:
case class A(_a: String, _b: String, _c: String)
val rows: ArrayBuffer[A] = ??? //or any Seq[A]
val spark: SparkSession = ???
spark.createDataFrame(rows)

gatear
- 946
- 2
- 10