我在做Sqoop时遇到以下错误。它试图将我的整个记录解析为单个时间戳字段。这有什么不对吗?
Caused by: java.sql.SQLException: Value '$d356aee0-09a3-4ddb-991e-61cae5758abd0000-00-00 00:00:002016-03-22 22:26:53$b4759fe2-aec6-11e1-8e54-00259060b612????????339-3661-6231-2d33-3038342d3431???
2015-09-30534-2d61-3966612d3437????016-08-17' can not be represented as java.sql.Timestamp
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
at com.mysql.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:1061)
at com.mysql.jdbc.BufferRow.getTimestampFast(BufferRow.java:576)
at com.mysql.jdbc.ResultSetImpl.getTimestampInternal(ResultSetImpl.java:6591)
at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:6191)
at org.apache.sqoop.lib.JdbcWritableBridge.readTimestamp(JdbcWritableBridge.java:111)
at com.cloudera.sqoop.lib.JdbcWritableBridge.readTimestamp(JdbcWritableBridge.java:83)
at QueryResult.readFields(QueryResult.java:199)
at org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:246)
... 12 more
答案 0 :(得分:0)
这是一个JDBC问题,可以通过将属性zeroDateTimeBehavior
设置为convertToNull
来处理。所以你的sqoop命令看起来像这样
sqoop import --connect jdbc:mysql://mysql-server:3306/database?zeroDateTimeBehavior=convertToNull