[ 
https://issues.apache.org/jira/browse/OOZIE-2949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16731989#comment-16731989
 ] 

Andras Salamon commented on OOZIE-2949:
---------------------------------------

I've checked the current version of the patch in more detail.
 
The plan was to handle commands like {{--query 'SELECT * FROM employee'}} and 
use two tokens in this case ({{"--query"}} and {{"SELECT * FROM employee"}}). 
The current patch works in this case.
 
It fails if single and double quotes are mixed like ' ... " .... " .... ' 
because it thinks that the first double quote closes the single quote. It would 
be easy to fix the patch and recognise the whole command like one token. 
 
I'm not sure if this is a good enough solution.
 
It will still fail if we want to use a single quote inside the query (e.g. 
search for O'Briens).

I've also talked to sqoop experts. The confirmed that sqoop command parsing is 
a rather complex task. If we want to be able to block-copy from shell to oozie, 
the best approach is probably mimicking the shell parsing. We would still need 
real-life examples to create lots of test cases.

> Escape quotes whitespaces in Sqoop <command> field
> --------------------------------------------------
>
>                 Key: OOZIE-2949
>                 URL: https://issues.apache.org/jira/browse/OOZIE-2949
>             Project: Oozie
>          Issue Type: Bug
>    Affects Versions: 4.3.0
>            Reporter: Peter Cseh
>            Assignee: Andras Salamon
>            Priority: Major
>             Fix For: 5.2.0
>
>         Attachments: OOZIE-2949-0.patch, OOZIE-2949-01.patch
>
>
> The current behavior of the Sqoop action is:
> {noformat}
> The Sqoop command can be specified either using the command element or 
> multiple arg elements.
> When using the command element, Oozie will split the command on every space 
> into multiple arguments.
> When using the arg elements, Oozie will pass each argument value as an 
> argument to Sqoop.
> {noformat}
> This prevents the user to simply copy-paste the command worked in the shell 
> into the workflow.xml.
> We should split the <command> field by taking quotes into account, similar to 
> what OOZIE-2391
> did for the Spark action's <spark-opts> field.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to