更新时间:2023-02-19 14:16:46
val result: DataFrame = sqlContext.read.json(path)
result.write.json("/yourPath")
The method write
is in the class DataFrameWriter and should be accessible to you on DataFrame
objects. Just make sure that your rdd is of type DataFrame
and not of deprecated type SchemaRdd
. You can explicitly provide type definition val data: DataFrame
or cast to dataFrame with toDF()
.