Sqoop will by default import NULL values as string null. Hive is however using string \N to denote NULL values and therefore predicates dealing with NULL (like IS NULL) will not work correctly. You should append parameters --null-string and --null-non-string in case of import job or --input-null-string and --input-null-non-string in case of an export job if you wish to properly preserve NULL values. Because sqoop is using those parameters in generated code, you need to properly escape value \N to \\N:
$ sqoop import ... --null-string '\\N' --null-non-string '\\N'
$ sqoop import ... --null-string '\\N' --null-non-string '\\N'

本文介绍如何使用Sqoop正确处理NULL值导入到Hive中,避免因NULL值表示方式不同导致的问题。通过设置特定参数确保NULL值被正确识别。
1580

被折叠的 条评论
为什么被折叠?



