Deleting blank line in rdd

自作多情 提交于 2019-12-01 22:27:52

问题


I'm a newbie to spark. I have an RDD which looks likes this

12434|arizona|2016-10-11|000
56783|california|2016-10-12|111

23456|Texas|2016-10-11|234

I am trying to delete the blank line between 2nd and 3rd row. I tried val rdd2=rdd1.filter(x=>x!='\n') but not working. Any suggestions how to resolve this will be helpful


回答1:


Try:

rdd1.filter(x => !x.isEmpty)


来源:https://stackoverflow.com/questions/40330276/deleting-blank-line-in-rdd

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!