How to extract a bz2 file in spark

雨燕双飞 提交于 2021-02-08 08:39:17

问题


I have a csv file zipped in bz2 format, like unix/linux do we have any single line command to extrac/decompress the file file.csv.bz2 to file.csv in spark-scala?


回答1:


You can use built in function in SparkContext(sc), this worked for me

sc.textFile("file.csv.bz2").saveAsTextFile("file.csv")


来源:https://stackoverflow.com/questions/52981195/how-to-extract-a-bz2-file-in-spark

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