pyspark.sql.functions.some

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

Aggregate function: returns true if at least one value of col is true.

New in version 3.5.0.

Parameters
colColumn or str

column to check if at least one value is true.

Returns
Column

true if at least one value of col is true, false otherwise.

Examples

>>> import pyspark.sql.functions as sf
>>> spark.createDataFrame(
...     [[True], [True], [True]], ["flag"]
... ).select(sf.some("flag")).show()
+----------+
|some(flag)|
+----------+
|      true|
+----------+
>>> import pyspark.sql.functions as sf
>>> spark.createDataFrame(
...     [[True], [False], [True]], ["flag"]
... ).select(sf.some("flag")).show()
+----------+
|some(flag)|
+----------+
|      true|
+----------+
>>> import pyspark.sql.functions as sf
>>> spark.createDataFrame(
...     [[False], [False], [False]], ["flag"]
... ).select(sf.some("flag")).show()
+----------+
|some(flag)|
+----------+
|     false|
+----------+