Hive 配置单元中的空验证,正在寻找最佳方法

Hive 配置单元中的空验证,正在寻找最佳方法,hive,Hive,我在datastage中有一个条件,它验证30列是否为非null,如果字段中的任何一列为null,则将值赋值为“0”,如下所示 select case when (columnA is NULL) then 0 case when (columnB is NULL) then 0 case when (columnC is NULL) then 0 . . . else 1 end as iValidColumn From tablea isnull(columnA)或

我在datastage中有一个条件,它验证30列是否为非null,如果字段中的任何一列为null,则将值赋值为“0”,如下所示

select 
 case when (columnA is NULL) then 0 
 case when (columnB is NULL) then 0 
 case when (columnC is NULL) then 0 
 .
 .
 .
 else 1 
end as iValidColumn
From tablea
isnull(columnA)或isnull(ColumnB)或isnull(columnC)或isnull(ColumnD),然后0或1。

我们可以选择在配置单元中使用用例语句来设置值,但是我们必须为每列提供用例语句,如下所示

select 
 case when (columnA is NULL) then 0 
 case when (columnB is NULL) then 0 
 case when (columnC is NULL) then 0 
 .
 .
 .
 else 1 
end as iValidColumn
From tablea
我在看什么


正在尝试寻找一个选项,在该选项中,我们可以验证空验证条件下的所有30列。

Hive有一个isnull函数,但您仍然需要将所有测试包装在一个case语句中:
case when isnull(col1)或isnull(col2)…然后0 end
。该表包含的列是否超过30列?您要查找的最终输出是什么?coalesce函数如何?@Andrew这有助于减少case语句的数量。@DuduMarkovitz它包含30多列,我正在尝试验证这些字段,并仅提取非空值,其余将返回错误表。