我想检查BigQuery结构(RECORD
类型,不重复)中的所有字段是否均为NULL。使用struct_column IS NULL
不起作用,因为即使false
中的所有字段均为NULL,它也会返回struct_column
。
答案 0 :(得分:0)
整个结构为NULL的语义与所有字段均为NULL的语义不同,您必须逐字段检查。
figure
输出:
create temp function all_fields_is_null(s struct<x int64, y int64>)
as (s.x is null and s.y is null);
select
all_fields_is_null((null, null)),
all_fields_is_null((1, null)),
all_fields_is_null((1, 1));