Reply
Expert Contributor
Posts: 139
Registered: ‎07-21-2014

Sqoop fails with "Error parsing arguments for import"

I've configured an Oozie workflow to run this Sqoop job:

 

<sqoop xmlns="uri:oozie:sqoop-action:0.2">
<job-tracker>my-node:8032</job-tracker>
<name-node>hdfs://my-node:8020</name-node>
<command>import --connect "jdbc:mysql://<url>" --username "dummy" --password "pwd" --query "SELECT col1, col2, CAST(REPLACE(SUBSTR(datecol,1,7), '-', '') AS UNSIGNED) as dateyyymm FROM src_table WHERE \$CONDITIONS" --target-dir /user/hive/warehouse/hive_table --fetch-size 0 --hive-import --hive-drop-import-delims --hive-table hive_table -m1</command>
<file>/tmp/hive-site.xml#hive-site.xml</file>
</sqoop>

 

The Sqoop command works fine if ran from command prompt, but I keep running into these errors using Oo:

 

[uber-SubtaskRunner] ERROR org.apache.sqoop.tool.BaseSqoopTool - Error parsing arguments for import:
[uber-SubtaskRunner] ERROR org.apache.sqoop.tool.BaseSqoopTool - Unrecognized argument: col1
[uber-SubtaskRunner] ERROR org.apache.sqoop.tool.BaseSqoopTool - Unrecognized argument: col2
[uber-SubtaskRunner] ERROR org.apache.sqoop.tool.BaseSqoopTool - Unrecognized argument:
CAST(REPLACE(SUBSTR(datecol,1,7),
[uber-SubtaskRunner] ERROR org.apache.sqoop.tool.BaseSqoopTool - Unrecognized argument: '-',
[uber-SubtaskRunner] ERROR org.apache.sqoop.tool.BaseSqoopTool - Unrecognized argument: '')
[uber-SubtaskRunner] ERROR org.apache.sqoop.tool.BaseSqoopTool - Unrecognized argument: AS
[uber-SubtaskRunner] ERROR org.apache.sqoop.tool.BaseSqoopTool - Unrecognized argument: UNSIGNED)
[uber-SubtaskRunner] ERROR org.apache.sqoop.tool.BaseSqoopTool - Unrecognized argument: as
[uber-SubtaskRunner] ERROR org.apache.sqoop.tool.BaseSqoopTool - Unrecognized argument: dateyyymm

..

...

 

 

 

Posts: 1,894
Kudos: 433
Solutions: 303
Registered: ‎07-31-2013

Re: Sqoop fails with "Error parsing arguments for import"

Please see
http://archive.cloudera.com/cdh5/cdh/5/oozie/DG_SqoopActionExtension.html:
"""
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.
The arg variant should be used when there are spaces within a single
argument.
"""

Your resolution is to transform all your command arguments into arg clauses
instead, and pass the whole SQL string as a single arg to make it be seen
as one element, rather than space separated args as it currently is trying
to parse it as.
Expert Contributor
Posts: 139
Registered: ‎07-21-2014

Re: Sqoop fails with "Error parsing arguments for import"

Thanks Harsha!

I'm using Oozie editor in Hue 3.6 and do not see any option to add 'args'. I attempted to use 'parameters' but upon submitting got an exception regarding invalid xml.

 

Screen Shot 2015-09-16 at 9.52.39 PM.png

 

 

Please let me know how to add the args.

Expert Contributor
Posts: 139
Registered: ‎07-21-2014

Re: Sqoop fails with "Error parsing arguments for import"

I got the oozie job to run after adding all the args under Parameters. thanks!

Highlighted
Posts: 1,894
Kudos: 433
Solutions: 303
Registered: ‎07-31-2013

Re: Sqoop fails with "Error parsing arguments for import"

Glad to hear you were able to figure it out. In spirit of https://xkcd.com/979/, please mark the thread solved with the solution post selected, so others with a similar problem can find their solution quicker on the web.
Announcements