BOOLAND_AGG¶
如果组中所有非 NULL 布尔记录的计算结果都是 TRUE,则返回 TRUE。
如果组内的所有记录均为 NULL,或者该组为空,则函数返回 NULL。
- 另请参阅:
语法¶
聚合函数
窗口函数
实参¶
expr输入表达式必须是不能计算为布尔或不能转换为布尔的表达式。
partition_expr此列或表达式指定如何将输入分隔到分区(子窗口)中。
返回¶
This function returns a value of type BOOLEAN.
使用说明¶
Numeric values are converted to
TRUEif they are non-zero.String and binary values aren't supported because they can't be converted to Boolean values.
当此函数作为窗口函数调用时,它不支持:
OVER 子句中的 ORDER BY 子句。
显式窗口框架。
示例¶
聚合函数
下面的示例显示,当所有输入值都为 true 时,booland_agg 返回 true。
创建并加载表:
显示数据:
查询数据:
窗口函数
此示例与上一个示例类似,但它将用法显示为窗口函数,其中输入行分为两个分区(一个表示 IDs 大于 0,一个表示 IDs 小于或等于 0)。其他数据已添加到表中。
向表中添加行:
显示数据:
查询数据:
错误示例
If this function is passed strings that can't be converted to Boolean, the function returns an error: