cloudera / hue

Open source SQL Query Assistant service for Databases/Warehouses
https://cloudera.com
Apache License 2.0
1.17k stars 366 forks source link

[oozie] Args cannot contain spaces #79

Closed andreaferretti closed 9 years ago

andreaferretti commented 10 years ago

It seems that the Hue interface for Oozie does not support spaces in args.

Namely, I am trying to add arguments with spaces in a Java action. Apparently the parser just splits the arguments string at spaces and escapes them. For instance --time "30 seconds" results in

<arg>--time</arg>
<arg>&quot;30</arg>
<arg>seconds&quot;</arg>

while --time 30\ seconds turns into

<arg>--time</arg>
<arg>30\</arg>
<arg>seconds</arg>

Neither results in

<arg>--time</arg>
<arg>30 seconds</arg>
romainr commented 10 years ago

The arg elements, if present, contains arguments for the main function. The value of each arg element is considered a single argument and they are passed to the main method in the same order. https://oozie.apache.org/docs/4.0.1/WorkflowFunctionalSpec.html#a3.2.7_Java_Action

Do you see the final command string executed by Oozie in the logs?

It might be fine:

--time "30 seconds"

-->

--time<>"30<>seconds"

andreaferretti commented 10 years ago

The problem is not in Oozie. Oozie can manage arguments with spaces, because arguments are wrapped inside the <arg> tag in XML. The problem is in the Hue interface to Oozie. The desired output would be two arguments - the first one being --time and the second one 30 seconds. In Oozie this happens with

<arg>--time</arg>
<arg>30 seconds</arg>

In bash, I can launch the program and quote the arguments, like --time "30 seconds".

What I am not able to do is to pass this argument in the Hue user interface

romainr commented 10 years ago

I see! I created https://issues.cloudera.org/browse/HUE-2146

Unfortunately I don't see any other workaround than not using a space for now (e.g. --time "30seconds", --time "30-seconds" ...) and updating the Java program to also understand this format.

skeltoac commented 10 years ago

I also experienced this while using tabs for record delimiters in a sqoop action. The arg '\t' would not work. I worked around the issue by recompiling sqoop with tab as the default delimiter.

ghost commented 8 years ago

I found a way to pass a space character as an oozie arg parameter. You have to double escape the octal value for the space character, i.e., "\040". So, let's say you want the arg parameter to be "Problem solved", you would need to enter "Problem\040solved".

The octal value for a space character is 040. For a bash script it would be \040. From oozie it needs to be \040.

ghost commented 8 years ago

Funny thing happened. After I wrote the comment above, I realized that it only showed a single back slash. So, I need to escape my comment, too! What I meant to say is this:

I found a way to pass a space character as an oozie arg parameter. You have to double escape the octal value for the space character, i.e., "\040". So, let's say you want the arg parameter to be "Problem solved", you would need to enter "Problem\040solved".

The octal value for a space character is 040. For a bash script it would be \040. From oozie it needs to be \040.