pyspark.sql.functions.bit_and

pyspark.sql.functions.bit_and(col: ColumnOrName) → pyspark.sql.column.Column[source]

Aggregate function: returns the bitwise AND of all non-null input values, or null if none.

New in version 3.5.0.

Parameters
colColumn or str

target column to compute on.

Returns
Column

the bitwise AND of all non-null input values, or null if none.

Examples

>>> df = spark.createDataFrame([[1],[1],[2]], ["c"])
>>> df.select(bit_and("c")).first()
Row(bit_and(c)=0)