Skip to content

EqualTo Predicate Expression

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

  • =, ==, <>, != SQL operators
  • Column.===, Column.=!= and Column.notEqual operators

Creating Instance

EqualTo takes the following to be created:

EqualTo is created when:

  • AstBuilder is requested to parse a comparison (for =, ==, <>, != operators) and visitSimpleCase
  • Column.===, Column.=!= and Column.notEqual operators are used
  • others

Symbol

symbol: String

symbol is part of the BinaryOperator abstraction.

symbol is = (equal sign).

Catalyst DSL

Catalyst DSL defines === operator to create an EqualTo 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.EqualTo
assert(e.expr.isInstanceOf[EqualTo])