简体   繁体   English

saveAsTextFile是否创建目录?

[英]Does the saveAsTextFile create the directories?

Does saveAsTextFile create the directories, if I am saving a text file and directory or path on a Linux machine does not exist? 如果要保存文本文件,并且Linux机器上的目录或路径不存在,则saveAsTextFile是否创建目录? Would the below Scala code create the test1 directory if it is not there? 下面的Scala代码是否会在test1目录中创建该目录?

rdd.saveAsTextFile ("file:///test1/textfile.txt");

Well, yes - as a quick test of the code you pasted shows. 是的-是对您粘贴的代码的快速测试所显示的。 Of course, the user must have the necessary permissions to create the directory. 当然,用户必须具有创建目录所需的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM