首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >来自mysql的Sqoop导入空值不替换null

来自mysql的Sqoop导入空值不替换null
EN

Stack Overflow用户
提问于 2017-02-18 02:55:25
回答 2查看 1.6K关注 0票数 2

在mysql中,有一个表,其中一些列具有空值。我想要sqoop将表导入到单元格中。当我进行sqoop导入时,我将在mysql表中包含空值的列中获取所有空值。

我正在做以下工作

代码语言:javascript
复制
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

但我还是得到了空荡荡的蜂巢

为什么会发生这种情况?我怎样才能得到想要的结果。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-02-18 03:24:44

当您将数据作为文本文件导入以指定空值时,将使用它。

解决方法可能是更改查询中的空值。根据数据库引擎的不同,它可能是这样的(sql server sintax)

-查询“从yourTable where $conditions中选择isnull(columnB,''),isnull(columnB,‘’)等”

票数 2
EN

Stack Overflow用户

发布于 2019-08-20 13:09:01

代码语言:javascript
复制
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
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42310564

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档