andrej-db commented on code in PR #48621:
URL: https://github.com/apache/spark/pull/48621#discussion_r1813209926


##########
sql/core/src/main/scala/org/apache/spark/sql/catalyst/util/V2ExpressionBuilder.scala:
##########
@@ -221,8 +221,18 @@ class V2ExpressionBuilder(e: Expression, isPredicate: 
Boolean = false) extends L
     case _: BitwiseNot => generateExpressionWithName("~", expr, isPredicate)
     case caseWhen @ CaseWhen(branches, elseValue) =>
       val conditions = branches.map(_._1).flatMap(generateExpression(_, true))
-      val values = branches.map(_._2).flatMap(generateExpression(_))
-      val elseExprOpt = elseValue.flatMap(generateExpression(_))
+      val values = branches.map(_._2).flatMap(child =>
+        generateExpression(
+          child,
+          isPredicate && child.dataType.isInstanceOf[BooleanType]

Review Comment:
   idk seems safer this way. I've seen somewhere in this file a similar check 
and made me wonder if we can have a Predicate that returns something else.
   
   I would keep it like this just in case, better safe then sorry.



-- 
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]

Reply via email to