dongjoon-hyun commented on a change in pull request #24873: [SPARK-28052][SQL] Make `ArrayExists` follow the three-valued boolean logic. URL: https://github.com/apache/spark/pull/24873#discussion_r293698570
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/higherOrderFunctions.scala ########## @@ -409,16 +411,23 @@ case class ArrayExists( override def nullSafeEval(inputRow: InternalRow, argumentValue: Any): Any = { val arr = argumentValue.asInstanceOf[ArrayData] val f = functionForEval - var exists = false + var foundNull = false var i = 0 - while (i < arr.numElements && !exists) { + while (i < arr.numElements) { elementVar.value.set(arr.get(i, elementVar.dataType)) - if (f.eval(inputRow).asInstanceOf[Boolean]) { - exists = true + val ret = f.eval(inputRow) + if (ret == null) { Review comment: So, this works like SQL `IN` based on the predicate result, right? Since this is a bug, it seems that we don't need a migration document. Could you add an example at [here](https://github.com/apache/spark/pull/24873/files#diff-ef52827ed9b41efc1fbd056a06ef7c6aR390)? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org