ueshin 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_r293700601
########## 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: sure, I'll add examples. ---------------------------------------------------------------- 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