Sqoop 日期字段导出报错

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/jobschen/article/details/81099784

想用sqoop 把导入到hive的基础表导出到另一个数据库。
Sqoop 导出数据时报如下错误:

java.lang.RuntimeException: Can't parse input data: '2018-07-18' at  
....
....
org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:89) ... 10 more Caused by: java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff] at java.sql.Timestamp.valueOf(Timestamp.java:204)
java.lang.RuntimeException: Can't parse input data: '2018-07-18 14:14:59.0' at 

字段在mysql中是datetime 类型
解决办法:
在import 时使用 –map-column-java 和 –map-column-hive 两个参数, 多个字段用逗号隔开

 --map-column-java  create_time=java.sql.Date, update_time=java.sql.Date 
 --map-column-hive  create_time=TIMESTAMP, update_time=TIMESTAMP 

在export 时 使用

--map-column-java create_time=java.sql.Date,update_time=java.sql.Date 

这样日期导出后会只有年月日,目前可以接受,后续再研究一下。

参考:http://www.cnblogs.com/wrencai/p/3935877.html

展开阅读全文

sqoop导出parquet到oracle时报错

11-11

sqoop导出普通文件时正常,导出parquet时报错,sqoop命令如下:rn sqoop export -D oracle.sessionTimeZone=CST --connect jdbc:oracle:thin:@172.31.27.201:1521:orcl --username SMCS --password smcs --table tb_xx01 --export-dir /user/hive/warehouse/basic_resource.db/tb_xx01 -m 4 --columns id,top_domain,is_alive,is_cdn,ip_addr,ip_addr_value,province,city,county,house_id,house_code,operators_jyxkzbh,operators_id,idc_isp_name,isp_id,idc_isp_id,yl1,yl2,yl3,top_domain_id,update_time --map-column-hive update_time=string --fields-terminated-by '\t' --input-null-string '\\N' --input-null-non-string '\\N'rn 错误日志:16/11/10 17:33:30 ERROR sqoop.Sqoop: Got exception running Sqoop: org.kitesdk.data.DatasetNotFoundException: Descriptor location does not exist: hdfs://act200:8020/user/hive/warehouse/basic_resource.db/tb_xx01/.metadatarnorg.kitesdk.data.DatasetNotFoundException: Descriptor location does not exist: hdfs://act200:8020/user/hive/warehouse/basic_resource.db/tb_xx01/.metadatarn at org.kitesdk.data.spi.filesystem.FileSystemMetadataProvider.checkExists(FileSystemMetadataProvider.java:562)rn at org.kitesdk.data.spi.filesystem.FileSystemMetadataProvider.find(FileSystemMetadataProvider.java:605)rn at org.kitesdk.data.spi.filesystem.FileSystemMetadataProvider.load(FileSystemMetadataProvider.java:114)rn at org.kitesdk.data.spi.filesystem.FileSystemDatasetRepository.load(FileSystemDatasetRepository.java:197)rn at org.kitesdk.data.Datasets.load(Datasets.java:108)rn at org.kitesdk.data.Datasets.load(Datasets.java:140)rn at org.kitesdk.data.mapreduce.DatasetKeyInputFormat$ConfigBuilder.readFrom(DatasetKeyInputFormat.java:92)rn at org.kitesdk.data.mapreduce.DatasetKeyInputFormat$ConfigBuilder.readFrom(DatasetKeyInputFormat.java:139)rn at org.apache.sqoop.mapreduce.JdbcExportJob.configureInputFormat(JdbcExportJob.java:84)rn at org.apache.sqoop.mapreduce.ExportJobBase.runExport(ExportJobBase.java:432)rn at org.apache.sqoop.manager.OracleManager.exportTable(OracleManager.java:455)rn at org.apache.sqoop.tool.ExportTool.exportTable(ExportTool.java:81)rn at org.apache.sqoop.tool.ExportTool.run(ExportTool.java:100)rn at org.apache.sqoop.Sqoop.run(Sqoop.java:143)rn at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)rn at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)rn at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)rn at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)rn at org.apache.sqoop.Sqoop.main(Sqoop.java:236)rnrnrnrnrn哪位大神能帮忙解答下,小弟不胜感激 论坛

sqoop从hdfs导出parquet到oracle报错,文本文件导出正常,

02-01

ERROR sqoop.Sqoop: Got exception running Sqoop: org.kitesdk.data.DatasetNotFoundException: Descriptor location does not exist: hdfs://nameservice1/user/hive/warehouse/eda.db/test_parquet/.metadatarnorg.kitesdk.data.DatasetNotFoundException: Descriptor location does not exist: hdfs://nameservice1/user/hive/warehouse/eda.db/test_parquet/.metadatarn at org.kitesdk.data.spi.filesystem.FileSystemMetadataProvider.checkExists(FileSystemMetadataProvider.java:562)rn at org.kitesdk.data.spi.filesystem.FileSystemMetadataProvider.find(FileSystemMetadataProvider.java:605)rn at org.kitesdk.data.spi.filesystem.FileSystemMetadataProvider.load(FileSystemMetadataProvider.java:114)rn at org.kitesdk.data.spi.filesystem.FileSystemDatasetRepository.load(FileSystemDatasetRepository.java:197)rn at org.kitesdk.data.Datasets.load(Datasets.java:108)rn at org.kitesdk.data.Datasets.load(Datasets.java:140)rn at org.kitesdk.data.mapreduce.DatasetKeyInputFormat$ConfigBuilder.readFrom(DatasetKeyInputFormat.java:92)rn at org.kitesdk.data.mapreduce.DatasetKeyInputFormat$ConfigBuilder.readFrom(DatasetKeyInputFormat.java:139)rn at org.apache.sqoop.mapreduce.JdbcExportJob.configureInputFormat(JdbcExportJob.java:84)rn at org.apache.sqoop.mapreduce.ExportJobBase.runExport(ExportJobBase.java:432)rn at org.apache.sqoop.manager.OracleManager.exportTable(OracleManager.java:456)rn at org.apache.sqoop.tool.ExportTool.exportTable(ExportTool.java:81)rn at org.apache.sqoop.tool.ExportTool.run(ExportTool.java:100)rn at org.apache.sqoop.Sqoop.run(Sqoop.java:143)rn at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)rn at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)rn at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)rn at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)rn at org.apache.sqoop.Sqoop.main(Sqoop.java:236) 论坛

没有更多推荐了,返回首页