将Spark数据框写入ASCII JSON [英] Writing spark dataframe to ascii JSON

查看:263
本文介绍了将Spark数据框写入ASCII JSON的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Spark数据帧编写为JSON文件;最终将其写到MapR JSON DB表中.

I am attempting to write a spark dataframe as JSON file; this will eventually be written out into MapR JSON DB table.

grp_small.toJSON.write.save("<path>")

这似乎以snappy.parquet格式写入JSON文件.如何强制将其写为可读的JSON(txt格式)?

This seems to write JSON file in snappy.parquet format. How do I force it to write it as a readable JSON (txt format) ?

推荐答案

您可以将数据帧写入json,其中每一行都以可读的json包含每一行.

You can write dataframe to json which contains each row as readable json in each line.

grp_small.write.json("path to output")

希望这个帮助!

这篇关于将Spark数据框写入ASCII JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆