snowflake.snowpark.functions.boolor¶

snowflake.snowpark.functions.boolor(expr1: Union[snowflake.snowpark.column.Column, str], expr2: Union[snowflake.snowpark.column.Column, str]) → Column[source]¶
Computes the Boolean OR of two numeric expressions. In accordance with Boolean semantics:
  • Non-zero values (including negative numbers) are regarded as True.

  • Zero values are regarded as False.

Parameters:
  • expr1 (ColumnOrName) – The first boolean expression.

  • expr2 (ColumnOrName) – The second boolean expression.

Returns:

  • True if both expressions are non-zero or the first expression is non-zero and the second expression is zero or None.

  • False if both expressions are zero.

  • None if both expressions are None or the first expression is None and the second expression is zero.

Example:

>>> from snowflake.snowpark.functions import col
>>> df = session.create_dataframe([
...     [1, 2],
...     [-1, 0],
...     [3, None],
...     [0, 0],
...     [None, 0],
...     [None, None]
... ], schema=["expr1", "expr2"])
>>> df.select(boolor(col("expr1"), col("expr2")).alias("result")).collect()
[Row(RESULT=True), Row(RESULT=True), Row(RESULT=True), Row(RESULT=False), Row(RESULT=None), Row(RESULT=None)]
Copy