BOOL_OR() OVER ...
All functions > WINDOW FUNCTION > BOOL_OR() OVER ...
Returns TRUE if any boolean value in the window frame is true.
Syntax
BOOL_OR(expr) [FILTER (WHERE condition) | WITHIN (WHERE condition)] OVER ([PARTITION BY expr [, ...]] [ORDER BY sort_item [, ...]] [ROWS|RANGE|GROUPS frame])
Notes
- Logical OR over all boolean values in the window
- Returns TRUE if any value is true
- NULL values are ignored
- Returns BOOLEAN type
See also
Examples
FeatureQL
SELECT
-- Running logical OR
f1 := ZIP(
ARRAY(1, 2, 3, 4) AS id,
ARRAY(30, 10, 20, 5) AS v,
ARRAY(TRUE, FALSE, TRUE, FALSE) AS b
).TRANSFORM(SELECT BOOL_OR(b) OVER (ORDER BY id ASC)).UNWRAP(),
-- Running OR counting only rows where v > 15 (10 and 5 excluded from the frame)
f2 := ZIP(
ARRAY(1, 2, 3, 4) AS id,
ARRAY(30, 10, 20, 5) AS v,
ARRAY(TRUE, FALSE, TRUE, FALSE) AS b
).TRANSFORM(SELECT BOOL_OR(b) FILTER (WHERE v > 15) OVER (ORDER BY id ASC)).UNWRAP()
;Result
| f1 ARRAY | f2 ARRAY |
|---|---|
| [true, true, true, true] | [true, true, true, true] |