从火花输出中删除括号 [英] remove parentheses from output in spark
本文介绍了从火花输出中删除括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我为了保存为文本文件输出在后来的结果导入到数据库正在使用saveAsTextFile(路径)。输出看起来是这样的:
(值1,值2)
我怎么能删除括号??
I'm using saveAsTextFile(path) in order to save output as text file in later to import the result to DB. The output looks something like this: (value1,value2) how can I remove the parentheses??
推荐答案
您可以尝试这是非常基本的以下内容:
You can try the following which is very basic:
rdd.map(x => x._1 + "," + x._2).saveAsTextFile(path)
您只需映射您的RDD [(A,B)到RDD [字符串]并保存它。
You just map your RDD[(A,B)] to an RDD[String] and save it.
这篇关于从火花输出中删除括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文