1

I have a file that has a square bracket in its name. This file needs to be uploaded to Hadoop via hadoop fs -put. I am using MapR 6.

The following variants lead to a put: unexpected URISyntaxException

hadoop fs -put aaa[bbb.txt /destination
hadoop fs -put aaa\[bbb.txt /destination
hadoop fs -put "aaa[bbb.txt" /destination
hadoop fs -put "aaa\[bbb.txt" /destination
Stefan Papp
  • 2,199
  • 1
  • 28
  • 54

2 Answers2

1

did you tried "aaa%5Bbbb.txt" ?

Jorge Machado
  • 752
  • 1
  • 8
  • 28
1

Hadoop commands such as hadoop fs -put generally do a bad job with escaping names.

That is the bad news.

The good news is that with MapR, you can avoid all of that and simply copy the file to a local mount of the MapR file system using standard Linux commands like cp. There is no need to "upload" anything because MapR feels and acts just like an ordinary file system. You can get the required mount using NFS or the POSIX drivers.

The big benefit of this is that you get the benefit of the maturity of the implementations of the Linux commands. That is, those commands (and the shell) do quoting correctly and you can get the result you want relatively trivially. Just use single quotes and be done with it.

Ted Dunning
  • 1,877
  • 15
  • 12