Hadoop Directory with Spaces

二次信任 提交于 2019-12-02 05:46:13

Replacing the space with %20 works for Hadoop shell. As in

sed 's/ /\%20/g'

And in the actual put command

hadoop fs -put "$inputDir" $putDest

Without the %20 you get a URI exception. (Which gave me my clue to use %20 over an escape character \ .)

I realize you're doing via Java. The fact that you're getting a java.io.FileNotFoundException makes me wonder if the code is doing something else with inputDir as opposed to being just the argument to the hadoop put, or an equivalent command of put. If it does any kind of checking of inputDir outside of Hadoop commands it will fail. Java sees it as a path. Hadoop sees it as a URI.

Hadoop does not support empty spaces in input directory paths.

Replace space with _ or your preferred separator character in your directory paths.

Try setting using set("path", "/abc/xyz/folder\\ name/abc.txt"); Kindly, note the double back slash.

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