ITPub博客

首页 > 大数据 > 数据挖掘 > sqoop抽取问题汇总

sqoop抽取问题汇总

原创 数据挖掘 作者:coolandbright 时间:2016-06-03 15:51:15 0 删除 编辑

23.2.5. MySQL: Import of TINYINT(1) from MySQL behaves strangely

Problem: Sqoop is treating TINYINT(1) columns as booleans, which is for example causing issues with HIVE import. This is because by default the MySQL JDBC connector maps the TINYINT(1) to java.sql.Types.BIT, which Sqoop by default maps to Boolean.

Solution: A more clean solution is to force MySQL JDBC Connector to stop converting TINYINT(1) to java.sql.Types.BIT by adding tinyInt1isBit=false into your JDBC path (to create something like jdbc:mysql://localhost/test?tinyInt1isBit=false). Another solution would be to explicitly override the column mapping for the datatype TINYINT(1) column. For example, if the column name is foo, then pass the following option to Sqoop during import: --map-column-hive foo=tinyint. In the case of non-Hive imports to HDFS, use --map-column-java foo=integer.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29665621/viewspace-2113524/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: mysql故障排查
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2014-05-19

  • 博文量
    14
  • 访问量
    19914