sqoop export Caused by: java.lang.RuntimeException: Can't parse input data: '\N'

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:164)

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:1698)

at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)

Caused by: java.lang.RuntimeException: Can't parse input data: '\N'

at t_app_transaction_detail_d.__loadFromFields(t_app_transaction_detail_d.java:1066)

at t_app_transaction_detail_d.parse(t_app_transaction_detail_d.java:914)

at org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:83)

... 10 more

Caused by: java.lang.NumberFormatException: For input string: "\N"

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

at java.lang.Integer.parseInt(Integer.java:580)

at java.lang.Integer.valueOf(Integer.java:766)

at t_app_transaction_detail_d.__loadFromFields(t_app_transaction_detail_d.java:978)

... 12 more

原因:hive表字段类型是int,存放的值是NULL,在导出到Mysql时,就会提示 java.lang.NumberFormatException: For input string: "\N",可以在生成int数据时,用COALESCE函数处理,COALESCE(field,0),这样即可解决"\N"问题。

 

你可能感兴趣的:(sqoop)