Sqoop将数据从oracle导入到hive时,数据错位问题
2018-03-29 10:22
856 查看
在使用sqoop将数据从oracle导入hive时,对数据进行验证,发现hive中的数据比oracle的多,然后发现多出来的数据严重错位,大量字段为null
怀疑是某些字段含有了hive默认的分隔符,如“\n”,“\r”,“\01”
解决办法是增加参数--hive-drop-import-delims来解决
以下是http://archive.cloudera.com/cdh/3/sqoop/SqoopUserGuide.html中摘抄的内容,很好的解释了该参数
Hive will have problems using Sqoop-imported data if your database’s rows contain string fields that have Hive’s default row delimiters (
可以从中看出,“\n”、“\r”是hive默认的行分隔符,而“\01”则是hive默认的列分隔符,如果数据中含有这些分隔符,在不处理的情况下,hive就会对数据进行错误的分割,造成数据错位以及数据增多的问题,解决办法就是
第一种,使用--hive-drop-import-delims 来去除这些字符
第二种,使用--hive-delims-replacement来替换这些字符
怀疑是某些字段含有了hive默认的分隔符,如“\n”,“\r”,“\01”
解决办法是增加参数--hive-drop-import-delims来解决
以下是http://archive.cloudera.com/cdh/3/sqoop/SqoopUserGuide.html中摘抄的内容,很好的解释了该参数
Hive will have problems using Sqoop-imported data if your database’s rows contain string fields that have Hive’s default row delimiters (
\nand
\rcharacters) or column delimiters (
\01characters) present in them. You can use the
--hive-drop-import-delimsoption to drop those characters on import to give Hive-compatible text data. Alternatively, you can use the
--hive-delims-replacementoption to replace those characters with a user-defined string on import to give Hive-compatible text data. These options should only be used if you use Hive’s default delimiters and should not be used if different delimiters are specified.
可以从中看出,“\n”、“\r”是hive默认的行分隔符,而“\01”则是hive默认的列分隔符,如果数据中含有这些分隔符,在不处理的情况下,hive就会对数据进行错误的分割,造成数据错位以及数据增多的问题,解决办法就是
第一种,使用--hive-drop-import-delims 来去除这些字符
第二种,使用--hive-delims-replacement来替换这些字符
相关文章推荐
- sqoop把oracle数据导入hive出现的问题
- 运用sqoop将数据从oracle导入到hive中的注意的问题
- 使用Sqoop将HDFS/Hive/HBase与MySQL/Oracle中的数据相互导入、导出
- Sqoop将Oracle数据导入HDFS时出现权限问题: Permission denied: user=root, access=WRITE,
- sqoop导入oracle数据至hive
- 使用Sqoop将HDFS/Hive/HBase与MySQL/Oracle中的数据相互导入、导出
- Sqoop_详细总结 使用Sqoop将HDFS/Hive/HBase与MySQL/Oracle中的数据相互导入、导出
- 使用Sqoop将Oracle数据导入Hive
- sqoop导入数据到hive中元数据问题
- 运用sqoop将数据从oracle导入到hive中的一些坑
- 利用sqoop 将 hive/hdfs数据 导入 Oracle中
- 《Sqoop将Oracle数据导入至Hive中界面无错却依旧没有数据导入》
- Sqoop_具体总结 使用Sqoop将HDFS/Hive/HBase与MySQL/Oracle中的数据相互导入、导出
- Sqoop工具使用(一)--从oracle导入数据到hive
- sqoop从oracle导入数据导hive表不支持的数据类型
- 使用Sqoop将数据从Hive导入MySQL可能遇到的问题
- SQOOP从Oracle导入数据到Hive时hang up在MapReduce作业过程
- 使用sqoop1.4.4从oracle导入数据到hive中错误记录及解决方案
- 用sqoop将oracle数据导入Hive
- Sqoop 连接Oracle导入数据到hive