hive列​​检查字符串'null'和真正的NULL

时间:2018-05-18 22:11:25

标签: hadoop hive

我有一个查询,其中许多列需要检查'null'或NULL然后移动空间

现在我们有column1='null' then ' ' else .... end

有许多具有上述条件的列

我想在hql查询中替换所有可以进行column1='null' or column1 is NULL

的操作

因为有很多列,我不能马上做,有没有办法我可以替换just ='null'来实现'null'和NULL

column1 in ('null',NULL) then ' ' did not work
column1='null' or NULL then ' ' did not work

1 个答案:

答案 0 :(得分:0)

您可以使用nvl函数。它将使用您想要的值替换null。

nvl(column1," ")

如果你想与null比较那么你应该使用'is null或者不是 in = =``不起作用