Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns same result as the EQUAL(=) operator for non-null operands, but returns true if both are null, false if one of them is null.
For the corresponding Databricks SQL function, see equal_null function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.equal_null(col1=<col1>, col2=<col2>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column or str |
The first column to compare. |
col2 |
pyspark.sql.Column or str |
The second column to compare. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(None, None,), (1, 9,)], ["a", "b"])
df.select('*', dbf.equal_null(df.a, df.b)).show()
+----+----+----------------+
| a| b|equal_null(a, b)|
+----+----+----------------+
|NULL|NULL| true|
| 1| 9| false|
+----+----+----------------+