BigQuery IS NOT NULL 条件不工作

BigQuery IS NOT NULL where condition not working

我正在尝试使用以下命令在 BigQuery 中创建 table。在我的原始数据集中,'customDimensions' 是一个包含 2 个子字段的嵌套列:值和索引。在我的查询中,我想要一个 where 条件来过滤掉 customDimensions.value IS NOT NULL 的记录。但是,在我的输出数据中,仍然有 PCF_CUST_ID 为空的记录。为什么我的 where 条件不起作用?

create table `putput_folder.output_data` as
select visitId
      ,(select value FROM t.customDimensions where index = 4) AS PCF_CUST_ID
from `input_folder.input_data_*` as t, UNNEST(customDimensions) as customDimensions
where _TABLE_SUFFIX between '20210101' and '20210131' and customDimensions.value is not null
order by visitId;

考虑以下几点:

select
  visitId,
  cd.value as PCF_CUST_ID
from `input_folder.input_data_*` as t
left join unnest(customDimensions) cd
where _TABLE_SUFFIX between '20210101' and '20210131'
  and cd.index = 4 and cd.value is not null
order by visitId

您的原始查询是选择每个 visitId,而不管它们是否具有 index=4