Sqoop异常 ERROR tool.ImportTool: Imported Failed: column not found

Sqoop导入数据到hive报列找不到异常,如下:

20/07/22 13:44:42 INFO mapreduce.ImportJobBase: Transferred 111.0097 MB in 40.0756 seconds (2.77 MB/sec)
20/07/22 13:44:42 INFO mapreduce.ImportJobBase: Retrieved 1301733 records.
20/07/22 13:44:42 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM [JOIN_UPLOADERROR] AS t WHERE 1=0
20/07/22 13:44:42 ERROR util.SqlTypeMap: It seems like you are looking up a column that does not
20/07/22 13:44:42 ERROR util.SqlTypeMap: exist in the table. Please ensure that you've specified
20/07/22 13:44:42 ERROR util.SqlTypeMap: correct column names in Sqoop options.
20/07/22 13:44:42 ERROR tool.ImportTool: Imported Failed: column not found: CANTONCODE

我是在使用sqoop从sqlserver导出数据到hive中报错,sqoop语句如下:

sqoop import --hive-import --connect ‘jdbc:sqlserver://ip:1433;username=xxxxxx;password=xxxxxx;database=xxxxxx’ --table JOIN_UPLOADERROR -m 1 --columns “CANTONCODE,YEAR,PERSONCODE,HEDINGCODE” --where “Year = ‘2018’” --hive-table db_test.Join_UploadError --hive-drop-import-delims --hive-overwrite --hive-partition-key dt --hive-partition-value 20200615 --null-non-string ‘\N’ --null-string ‘\N’ --delete-target-dir

网上查到的解决方法是将字段和表名都大写,测试之后错误还是没有解决。

解决方法:

1、使用Navicat查看建表语句,
CREATE TABLE [dbo].[Join_UploadError] (
[CantonCode] varchar(max) COLLATE Chinese_PRC_CI_AS NOT NULL,
[Year] varchar(max) COLLATE Chinese_PRC_CI_AS NOT NULL,
[PersonCode] varchar(max) COLLATE Chinese_PRC_CI_AS NOT NULL,
[hedingcode] varchar(max) COLLATE Chinese_PRC_CI_AS NOT NULL
)
2、sqoop语句中字段复制建表语句中的字段,如下:
sqoop import --hive-import --connect ‘jdbc:sqlserver://ip:1433;username=xxxxxx;password=xxxxxxx;database=xxxxxx’ --table JOIN_UPLOADERROR -m 1 --columns “CantonCode,Year,PersonCode,hedingcode” --where “Year = ‘2018’” --hive-table db_test.JOIN_UPLOADERROR --hive-drop-import-delims --hive-overwrite --hive-partition-key dt --hive-partition-value 20200615 --null-non-string ‘\N’ --null-string ‘\N’ --delete-target-dir

最终执行成功。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值