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
-- Bitwise AND over one group
RETURN
    f1 := ZIP(ARRAY(1, 1) AS g, ARRAY(3, 5) AS x).TRANSFORM(
        DEFINE
            p := BIT_AND(x) GROUP BY (g)
        RETURN p
    ).UNWRAP_ONE()
;
Result
f1 BIGINT
1