解决sqoop报错Invalid number; item = ITEM_UNICODE

Posted 凿石刻字

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决sqoop报错Invalid number; item = ITEM_UNICODE相关的知识,希望对你有一定的参考价值。

报错栈:

java.sql.SQLException: Invalid number; item = ITEM_UNICODE
    at com.intersys.jdbc.SysList.getInt(SysList.java:1735)
    at com.intersys.jdbc.CacheResultSet.getInt(CacheResultSet.java:247)
    at org.apache.sqoop.lib.JdbcWritableBridge.readInteger(JdbcWritableBridge.java:52)
    at com.cloudera.sqoop.lib.JdbcWritableBridge.readInteger(JdbcWritableBridge.java:53)
    at QueryResult.readFields(QueryResult.java:246)
    at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:244)
    at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:556)
    at org.apache.hadoop.mapreduce.task.MapContextImpl.nextKeyValue(MapContextImpl.java:80)
    at org.apache.hadoop.mapreduce.lib.map.WrappedMapper$Context.nextKeyValue(WrappedMapper.java:91)
    at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
    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:1657)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)

问题的根本原因是字段值类型异常,本来应该是数字型,里面却存了unicode字符。使用报错信息查不到相关资料,另外增加参数也不能解决:-D mapreduce.map.failures.maxpercent=1, query里面增加: and Specimen is not null 也不能解决。(Specimen是报错字段)。

靠谱的解决办法是找出这行异常数据,在数据库中纠正或删除。如果想临时解决,可以把这个字段在导入时转换类型为字符:--map-column-java Specimen=String。

以上是关于解决sqoop报错Invalid number; item = ITEM_UNICODE的主要内容,如果未能解决你的问题,请参考以下文章

Nginx在reload时候报错invalid PID number

nginx: [error] invalid PID number "" in "/run/ngin

sqoop启动job报错,怎么解决

Nginx 负载均衡 - linux下nginx加载配置文件异常处理,提示invalid PID number in “/run/nginx.pid“问题解决

ODI 问题集锦 - Return Code 1722 invalid number

python解码bash64报错:binascii.Error: Invalid base64-encoded string: number of data characters (7121) can