EqualNullSafe Predicate Expression¶
EqualNullSafe
is a BinaryComparison predicate expression that represents the following high-level operators in a logical plan:
<=>
SQL operatorColumn.<=>
operator
Null Safeness¶
EqualNullSafe
is safe for null
values, i.e. is like EqualTo with the following "safeness":
true
if both operands arenull
false
if either operand isnull
Creating Instance¶
EqualNullSafe
takes the following to be created:
- Left Expression
- Right Expression
EqualNullSafe
is created when:
AstBuilder
is requested to parse a comparison (for<=>
operator) and withPredicateColumn.<=>
operator is used- others
Symbol¶
symbol: String
symbol
is part of the BinaryOperator
abstraction.
symbol
is <=>
.
nullable¶
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
assert(e.expr.isInstanceOf[EqualNullSafe])