开发者社区> 问答> 正文

你们数据库怎么导入hive 的,有没有出现问题

你们数据库怎么导入hive 的,有没有出现问题

展开
收起
愚笨如你 2020-02-14 19:14:52 1205 0
1 条回答
写回答
取消 提交回答
  •  在导入hive的时候,如果数据库中有blob或者text字段,会报错,解决方案在sqoop笔记中。在将数据由Oracle数据库导入到Hive时,发现带有clob字段的表的数据会错乱,出现一些字段全为NULL的空行。

      由于在项目中CLOB字段没有实际的分析用途,因此考虑将CLOB字段去掉。

      同时,为了防止CLOB字段产生一些问题,因此将HIVE中CLOB字段禁用,禁用的方式如下:

      [Hadoop@master sqoop-1.4.5]$ cd $SQOOP_HOME/conf

      [hadoop@master conf]$ vi oraoop-site.xml

      将以下属性的注释去掉,并且将value改为true

      oraoop.import.omit.lobs.and.long

      true

      If true, OraOop will omit BLOB, CLOB, NCLOB and LONG columns during an Import.

      有些表中虽然有clob字段,但是不能排除掉,因为其他字段使我们所需要,因此在导入的时候采用指定--columns的方式来进行导入

      sqoop import --hive-import --hive-database test --create-hive-table --connect jdbc --username user--password user

      --bindir //scratch --outdir /Java --table aaa --columns "ID,NAME" -m 1 --null-string '\N' --null-non-string '\N'

    2020-02-14 19:15:21
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Hive Bucketing in Apache Spark 立即下载
spark替代HIVE实现ETL作业 立即下载
2019大数据技术公开课第五季—Hive迁移到MaxCompute最佳实践 立即下载