当数组包含空值时,如何使用 arrayExists 函数?

How can I use arrayExists function when the array contains a null value?

我的 table 中有一个可为空的数组列:Array(Nullable(UInt16))。我希望能够使用 arrayExists(或 arrayAll)查询此列,以检查它是否包含高于某个阈值的值,但是当数组包含空值时出现异常:

异常:函数 arrayExists 的表达式必须 return UInt8,找到 Nullable(UInt8)

我的查询在 distance 是数组列的下方:

SELECT * from TracabEvents_ArrayTest
where arrayExists(x -> x > 9, distance);

我已经尝试将 lambda 中的比较更新为“(isNotNull(x) and x > 9)”,但我仍然遇到错误。有什么方法可以处理这些表达式中的空值,或者它们是否还不受支持?

为 arrayExists 中的 x 使用 notEmpty 和 assumeNotNull 添加条件以过滤具有空列表的行。

SELECT * FROM TracabEvents_ArrayTest WHERE notEmpty(distance) AND arrayExists(x -> assumeNotNull(x) > 9, distance)