jchen5 commented on code in PR #42163:
URL: https://github.com/apache/spark/pull/42163#discussion_r1274337801
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala:
##########
@@ -481,88 +483,104 @@ case class In(value: Expression, list: Seq[Expression])
extends Predicate {
override def toString: String = s"$value IN ${list.mkString("(", ",", ")")}"
override def eval(input: InternalRow): Any = {
- val evaluatedValue = value.eval(input)
- if (evaluatedValue == null) {
- null
+ if (list.isEmpty && !legacyNullInEmptyBehavior) {
+ // IN (empty list) is always false under current behavior.
+ // Under legacy behavior it's null if the left side is null, otherwise
false (SPARK-44550).
+ false
} else {
- var hasNull = false
- list.foreach { e =>
- val v = e.eval(input)
- if (v == null) {
- hasNull = true
- } else if (ordering.equiv(v, evaluatedValue)) {
- return true
- }
- }
- if (hasNull) {
+ val evaluatedValue = value.eval(input)
Review Comment:
Note: most of these changes are just whitespace, use hide whitespace mode
for easier review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]