【问题标题】:Sqoop - Error while exporting from hive to mysqlSqoop - 从 hive 导出到 mysql 时出错
【发布时间】:2017-08-21 09:52:53
【问题描述】:

我在使用 sqoop 将 hive bigint 数据导出到 mysql 时遇到问题。

mysql和hive中列的类型是bigint。

我收到以下错误:

Caused by: java.lang.NumberFormatException: For input string: "3465195470"
...
At java.lang.Integer.parseInt (Integer.java:583)

在将hdfs中存储的字符串转换为数字类型时似乎出现错误。

hive 和 mysql 列都是 bigint 类型,如何解决?

添加 sqoop 命令

export -connect "jdbc:mysql://{url}/{db}?{option}" 
--username {username} 
--password {password} 
--table {username} 
--columns  "column1,column2,column3"  
--export-dir /apps/hive/warehouse/tmp.db/{table} 
--update-mode allowinsert 
--update-key column1 
--input-fields-terminated-by "\001"   
--input-null-string "\\N"  
--input-null-non-string "\\N" 
--null-string "\\N"  
--null-non-string "\\N"

【问题讨论】:

  • 请分享 sqoop 导出命令
  • 使用字符串类型
  • 可惜mysql列的类型已经是bigint了。
  • 请给我们看命令?
  • 我在文章中添加了sqoop命令。

标签: mysql hadoop hive sqoop


【解决方案1】:

这可能是由于缺少列或列位置错误而导致的问题。

也不需要--null-string-null-non-string。这些用于sqoop import 命令。

【讨论】: