Google BigQuery 的意外行为 WHERE NOT list CONTAINS string

unexpected behaviour of Google BigQuery WHERE NOT list CONTAINS string

我有一个小例子tabletemp.ty 从这个 table 我只想提取 not_ipc 中不存在 ipc 的行(以及 other_classes 中不存在 exclude 的行),这似乎相当直截了当。然而,以下查询 returns 零结果:

SELECT * FROM temp.ty where not ipc contains not_ipc

如果我用 'G01N 33' 替换 not_ipc 它也不起作用,如果我用 'G01N' 替换 not_ipc 它就可以正常工作。

我已经尝试过使用通配符和 LIKE 操作以及 STRING() 函数的变体,但到目前为止我还无法处理。 我有一种强烈的感觉,我错过了什么,但我想不通。

这是一个示例查询:

select * from
(select 'G01N 33/55' as ipc, 'G01N 34' as not_ipc),
(select 'G01N 33/55' as ipc, 'G01N 33' as not_ipc),
(select 'G01N 33/55' as ipc, string(null) as not_ipc)
where not ipc contains not_ipc or not_ipc is null

这个returns:

+-----+------------+---------+---+
| Row |    ipc     | not_ipc |   |
+-----+------------+---------+---+
|   1 | G01N 33/55 | G01N 34 |   |
|   2 | G01N 33/55 | null    |   |
+-----+------------+---------+---+

这是另一个:

select * from
(select 'G01N 33/55' as ipc, 'G01N 33' as not_ipc, 'C08K 3/08' as exclude, 'C08K 3/08,C08K 77/02' as other_classes),
(select 'G01N 33/55' as ipc, 'G01N 34' as not_ipc, string(null) as exclude, 'C08K 3/08,C08K 77/02' as other_classes),
(select 'G01N 33/55' as ipc, 'G01N 33' as not_ipc, string(null) as exclude, string(null) as other_classes),
(select 'G01N 33/55' as ipc, 'G01N 36' as not_ipc, string(null) as exclude, string(null) as other_classes),
(select 'G01N 33/55' as ipc, string(null) as not_ipc, 'C08K 3/08' as exclude, string(null) as other_classes)
where (not ipc contains not_ipc or not_ipc is null) and (not other_classes contains exclude or exclude is null or other_classes is null)

returns:

+-----+------------+---------+-----------+----------------------+---+
| Row |    ipc     | not_ipc |  exclude  |    other_classes     |   |
+-----+------------+---------+-----------+----------------------+---+
|   1 | G01N 33/55 | G01N 34 | null      | C08K 3/08,C08K 77/02 |   |
|   2 | G01N 33/55 | G01N 36 | null      | null                 |   |
|   3 | G01N 33/55 | null    | C08K 3/08 | null                 |   |
+-----+------------+---------+-----------+----------------------+---+