Sqoop export to SQL server - Can't parse string value (NTL-NATIONAL)

I am trying to export Hive table by using Sqoop to SQL server. I have a string field in hive table and the format of this field in SQL server is varchar(255). While running the following Sqoop export:

sqoop export -Dmapreduce.job.queuename=default
 --connect 'jdbc:sqlserver://IPaddress:portnumber;databasename=mydbname'
 --username xxx 
 --password  xxx 
 --table tablename 
 --export-dir /hive_directory/tablename 
 --columns all_my_columns 
 --input-fields-terminated-by '^' 
 --input-null-string "\\\\N" --input-null-non-string "\\\\N" 

I get below error. The field values are likeā€¦ NTL-NATIONAL. Appreciate any thoughts to parse this value. Thank you.

INFO mapreduce.Job: Task Id : attempt_1468858380028_769962_m_000002_0, Status : FAILED
Error: java.io.IOException: Can't export data, please check failed map task logs
        at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:112)
        at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:39)
        at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:146)
        at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:787)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
        at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
        at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:162)
Caused by: java.lang.RuntimeException: Can't parse input data: 'NTL-NATIONAL'
        at test_fnl.__loadFromFields(test_fnl.java:1109)
        at test_fnl.parse(test_fnl.java:952)
        at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:83)
        ... 10 more
Caused by: java.util.NoSuchElementException
        at java.util.ArrayList$Itr.next(ArrayList.java:854)
        at test_fnl.__loadFromFields(test_fnl.java:1104)
        ... 12 more

Answers


Did you try including this argument?

--input-lines-terminated-by <char>

i.e

--input-lines-terminated-by '\n'

Need Your Help

Gettiing Year from another table

sql-server-2008 sql-server-2008-r2

I have a field named 'SALARY ON' in which data(year-month) entered is in format '2012-01'(datatype varchar) in table named Table1.For creating a sp i need to take only 2012 from above mentioned table

Text boxes not being updated while VBA sub active

excel vba excel-vba

I have a large cell in sheet "main" containing several text controls. These are linked to named cells in sheet "Refs". There's a button in "main" that launches a VBA sub.