Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sqoop从mysql导入空值不会替换空值_Mysql_Null_Hive_Sqoop - Fatal编程技术网

Sqoop从mysql导入空值不会替换空值

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

在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-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