Skip to content

LessThanOrEqual

LessThanOrEqual is a binary comparison expression and a NullIntolerant.

LessThanOrEqual's symbol representation is <=.

Creating Instance

LessThanOrEqual takes the following to be created:

symbol

symbol: String

symbol is part of the BinaryOperator abstraction.


symbol is <=.

nullSafeEval

nullSafeEval(
  input1: Any,
  input2: Any): Any

nullSafeEval is part of the BinaryOperator abstraction.


nullSafeEval requests the Ordering to lteq the inputs.

Catalyst DSL

expressions defines <= operator to create a LessThanOrEqual expression.

import org.apache.spark.sql.catalyst.dsl.expressions._

// LessThanOrEqual
val e = col("a").expr <= 5

import org.apache.spark.sql.catalyst.expressions.LessThanOrEqual
val lessThanOrEqual = e.asInstanceOf[LessThanOrEqual]

FIXME

import org.apache.spark.sql.catalyst.InternalRow
val input = InternalRow(1, 2)
scala> lessThanOrEqual.eval(input)
org.apache.spark.SparkUnsupportedOperationException: Cannot evaluate expression: 'a
at org.apache.spark.sql.errors.QueryExecutionErrors$.cannotEvaluateExpressionError(QueryExecutionErrors.scala:73)
at org.apache.spark.sql.catalyst.expressions.Unevaluable.eval(Expression.scala:344)
at org.apache.spark.sql.catalyst.expressions.Unevaluable.eval$(Expression.scala:343)
at org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute.eval(unresolved.scala:131)
at org.apache.spark.sql.catalyst.expressions.BinaryExpression.eval(Expression.scala:634)
... 54 elided