1.当出现java.lang.RuntimeException: Can’t parse input data: ‘\N’这个错误或者是报什么NumberFormalt异常的话时候,说明你的hive表中有空值null,MySQL无法识别
导入语句为:bin/sqoop export –connect jdbc:mysql://node-2:3306/qilap_db –username root –password root –table t_question_amendment –num-mappers 1 –export-dir /user/hive/warehouse/qilap.db/amend_table –input-fields-terminated-by “\001”
2.检查语句,也没有错误,因为hive中为null的是以\N代替的,所以你在导入到MySql时,需要加上两个参数:–input-null-string ‘\\N’ –input-null-non-string ‘\\N’,多加一个’\’,是为转义。
改写后为:
bin/sqoop export –connect jdbc:mysql://node-2:3306/qilap_db –username root –password root –table t_question_amendment1 –num-mappers 1 –export-dir /user/hive/warehouse/qilap.db/amend_table1 –input-fields-terminated-by “\001” –input-null-string “\\N” –input-null-non-string “\\N”
再次导入,就可以正常导入了
————————————————
版权声明:本文为CSDN博主「乌镇风云」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_43087634/article/details/85239677