Skip to content

EqualNullSafe Predicate Expression

EqualNullSafe is a BinaryComparison predicate expression that represents the following high-level operators in a logical plan:

  • <=> SQL operator
  • Column.<=> operator

Null Safeness

EqualNullSafe is safe for null values, i.e. is like EqualTo with the following "safeness":

  • true if both operands are null
  • false if either operand is null

Creating Instance

EqualNullSafe takes the following to be created:

EqualNullSafe is created when:


symbol: String

symbol is part of the BinaryOperator abstraction.

symbol is <=>.


nullable: Boolean

nullable is part of the Expression abstraction.

nullable is always false.

Catalyst DSL

Catalyst DSL defines <=> operator to create an EqualNullSafe expression.

import org.apache.spark.sql.catalyst.dsl.expressions._
val right = 'right
val left = 'left
val e = right <=> left
scala> e.explain(extended = true)
('right <=> 'left)
scala> println(e.expr.sql)
(`right` <=> `left`)
import org.apache.spark.sql.catalyst.expressions.EqualNullSafe