How can I convert an RDD (org.apache.spark.rdd.RDD[org.apache.spark.sql.Row]
) to a Dataframe org.apache.spark.sql.DataFrame
. I converted a dataframe to rdd using .rdd
. After processing it I want it back in dataframe. How can I do this ?
相关问题
- How to maintain order of key-value in DataFrame sa
- Unusual use of the new keyword
- Get Runtime Type picked by implicit evidence
- Spark on Yarn Container Failure
- What's the point of nonfinal singleton objects
相关文章
- Gatling拓展插件开发,check(bodyString.saveAs("key"))怎么实现
- Livy Server: return a dataframe as JSON?
- RDF libraries for Scala [closed]
- Why is my Dispatching on Actors scaled down in Akk
- How do you run cucumber with Scala 2.11 and sbt 0.
- GRPC: make high-throughput client in Java/Scala
- Setting up multiple test folders in a SBT project
- SQL query Frequency Distribution matrix for produc
On newer versions of spark (2.0+). This will also work even without a sqlcontext available.
SqlContext
has a number ofcreateDataFrame
methods that create aDataFrame
given anRDD
. I imagine one of these will work for your context.For example:
To convert an Array[Row] to DataFrame or Dataset, the following works elegantly:
Say, schema is the StructType for the row,then
Assuming val spark is a product of a SparkSession.builder...
Same steps, but with fewer val declarations: