공부
[Spark] to_json (need to spark 2.1)
승가비
2020. 10. 3. 20:08
728x90
import org.apache.spark.sql.functions.to_json
df.select(to_json(struct($"c1", $"c2", $"c3")))
https://stackoverflow.com/questions/36157810/spark-row-to-json
Spark Row to JSON
I would like to create a JSON from a Spark v.1.6 (using scala) dataframe. I know that there is the simple solution of doing df.toJSON. However, my problem looks a bit different. Consider for insta...
stackoverflow.com
https://spark.apache.org/docs/2.1.0/api/java/org/apache/spark/SparkFiles.html#getRootDirectory()
SparkFiles (Spark 2.1.0 JavaDoc)
static String get(String filename) Get the absolute path of a file added through SparkContext.addFile().
spark.apache.org
728x90