BIT_AND() OVER ...

All functions > WINDOW FUNCTION > BIT_AND() OVER ...

Returns the bitwise AND of integer values in the window frame.

Syntax

BIT_AND(expr) OVER ([PARTITION BY expr [, ...]] [ORDER BY sort_item [, ...]] [ROWS|RANGE|GROUPS frame])

Notes

  • SQL translation is implemented only when the current SQL backend is DuckDB
  • Requires a well-defined window (ORDER BY, and optionally PARTITION BY and frame)
  • NULL values are ignored where the underlying window aggregate skips NULLs
  • Argument type must be an integer type

See also

Examples

FeatureQL
SELECT
    f1 := ZIP(ARRAY[1,2,3] AS id, ARRAY[3, 5, 6] AS x).TRANSFORM(SELECT BIT_AND(x) OVER (ORDER BY id ASC)).UNWRAP() -- Running bitwise AND
;
Result
f1 ARRAY
[3, 1, 0]

Last update at: 2026/05/26 17:22:09