BIT_AND() GROUP BY ...

All functions > GROUP BY > BIT_AND() GROUP BY ...

Returns the bitwise AND of all integer values in the group.

Syntax

BIT_AND(expr)
 [ FILTER (WHERE condition) ]
  [ GROUP BY feature [, feature ...] ]

Notes

  • NULL values are ignored where the underlying aggregate skips NULLs
  • Can be used with FILTER (WHERE condition) and GROUP BY like other aggregates
  • Argument type must be an integer type

Examples

FeatureQL
SELECT
    f1 := ZIP(ARRAY[1, 1] AS g, ARRAY[3, 5] AS x).TRANSFORM(SELECT BIT_AND(x) GROUP BY g).UNWRAP_ONE() -- Bitwise AND over one group
;
Result
f1 BIGINT
1

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