sqoop:将数据从hdfs导出到teradata时将字符串转换为日期

gopyfrb3  于 2021-05-29  发布在  Hadoop
关注(0)|答案(0)|浏览(329)

我有一个teradata表和一列, update_date ,定义为日期。格式为yyyymmdd。我需要上传hdfs文件到表中。这些文件是逗号分隔的文本文件。对应于的列 update_date 是格式为“yyyymmdd”的字符串。
当我尝试使用命令导出数据时:

sqoop export --connect jdbc:teradata://tdwc/DATABASE=sandbox --username xxxx --password yyyy --table mytable --export-dir hftp://gdoop-namenode/path/to/myfiles/

命令失败,出现错误

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:140)
at org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:672)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:330)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1438) 
at org.apache.hadoop.mapred.Child.main(Child.java:262)  
Caused by: java.lang.RuntimeException: Can't parse input data: '20160129'

如何在不更改表架构的情况下解决此问题?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题