您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
这篇文章主要讲解了“Sqoop在导入MySQL数据时遇到Timestamp列为空时报错怎么办”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Sqoop在导入MySQL数据时遇到Timestamp列为空时报错怎么办”吧!
Error: java.io.IOException: SQLException in nextKeyValue at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:277) 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: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.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) at com.mysql.jdbc.ResultSetRow.getDateFast(ResultSetRow.java:141) at com.mysql.jdbc.ByteArrayRow.getDateFast(ByteArrayRow.java:238) at com.mysql.jdbc.ResultSetImpl.getDate(ResultSetImpl.java:2185) at com.mysql.jdbc.ResultSetImpl.getDate(ResultSetImpl.java:2147) at org.apache.sqoop.lib.JdbcWritableBridge.readDate(JdbcWritableBridge.java:115) at com.cloudera.sqoop.lib.JdbcWritableBridge.readDate(JdbcWritableBridge.java:87) at party_org.readFields(party_org.java:441) at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:244) ... 12 more
Sqoop在导入MySQL数据时遇到Timestamp列为空时报错,解决方法是:在JDBC连接后加上?zeroDateTimeBehavior=convertToNull
例如:
sqoop import --driver com.mysql.jdbc.Driver --connect jdbc:mysql://192.168.4.48:3306/xdgc?zeroDateTimeBehavior=convertToNull --username root --password <...> --table party_org --hive-import --hive-table ori.party_org --incremental lastmodified --check-column last_update_time --last-value '2014-01-01 00:00:00.000'
感谢各位的阅读,以上就是“Sqoop在导入MySQL数据时遇到Timestamp列为空时报错怎么办”的内容了,经过本文的学习后,相信大家对Sqoop在导入MySQL数据时遇到Timestamp列为空时报错怎么办这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。