VSEWHGHP
VSEWHGHP

Reputation: 305

Mapreduce write to directory with space in name

I am trying to write to a directory with a space in the name, but after trying many escape sequences using ' and ", I did not have any luck.

Essentially I have a path to a directory on hdfs:

/sample/123456/test 1_record/
inside we can have the part-0000.... files

I am passing in the path above from a shell script to my MR job. Any recommendations or ideas would be appreciated

EDIT: I know it is possible to create directories with spaces in the name, I just can't seem to have it be created and populated from my mapreduce code

Upvotes: 1

Views: 52

Answers (2)

VSEWHGHP
VSEWHGHP

Reputation: 305

The best way I found to handle this was to basically encode my name so that the space was mapped to a special character, ie. '@' sign. I knew this character was not allowed in the name itself and HDFS did not mind it. I know this is not ideal but after looking around this was the best solution I could find.

Upvotes: 0

gmcontessa
gmcontessa

Reputation: 558

In linux, paths can be created with spaces by escaping in this way:

/sample/123456/test\ 1_record/

See if that works!

Upvotes: 1

Related Questions