Sqoop从mysql导入空值不会替换空值
在mysql中,有一个表,其中一些列的值为空。我想用sqoop将表导入到配置单元。当我执行sqoop导入时,我将在mysql表中具有null的列中获取所有null值 我正在做以下工作Sqoop从mysql导入空值不会替换空值,mysql,null,hive,sqoop,Mysql,Null,Hive,Sqoop,在mysql中,有一个表,其中一些列的值为空。我想用sqoop将表导入到配置单元。当我执行sqoop导入时,我将在mysql表中具有null的列中获取所有null值 我正在做以下工作 sqoop import --connect jdbc:xxxxxx --username xxxx --password xxxx \ --query "select * from hive_db.xxxx where \$CONDITIONS" --null-string '' \ --null-non-st
sqoop import --connect jdbc:xxxxxx --username xxxx --password xxxx \
--query "select * from hive_db.xxxx where \$CONDITIONS" --null-string '' \
--null-non-string '' -m 1 --hive-import --hive-database hivedatabase \
--hive-table table --as-parquetfile --create-hive-table --target-dir /user/hive/warehouse/hivedatabase.db/table
但我仍然将配置单元列作为Null intsead of empty
为什么会这样?我如何获得期望的结果 将数据作为文本文件导入以指定空值时使用 解决方法是更改查询中的空值。根据数据库引擎的不同,它可能类似于sql server sintax
-查询从表中选择isnullcolumnA、isnullcolumnB等,其中$conditions所以我们不能将其用于parquetyes,一个更痛苦的解决方法是转换查询中的空值请查看
sqoop import --connect jdbc:xxxxxx --username xxxx --password xxxx \
--query "select * from hive_db.xxxx where \$CONDITIONS" --null-string " " \
--null-non-string " " -m 1 --hive-import --hive-database hivedatabase \
--hive-table table --as-parquetfile --create-hive-table --target-dir /user/hive/warehouse/hivedatabase.db/table