HIVE CLOB字段处理

来源:互联网 发布:tftp 端口号 编辑:程序博客网 时间:2024/05/18 16:39

在将数据由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

  <property>
    <name>oraoop.import.omit.lobs.and.long</name>
    <value>true</value>
    <description>If true, OraOop will omit BLOB, CLOB, NCLOB and LONG columns during an Import.
    </description>
  </property>


有些表中虽然有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'

0 0
原创粉丝点击