findepi commented on code in PR #13497: URL: https://github.com/apache/datafusion/pull/13497#discussion_r1849931968
########## datafusion/physical-expr/src/equivalence/properties.rs: ########## @@ -1208,7 +1208,12 @@ fn is_constant_recurse( return true; } let children = expr.children(); - !children.is_empty() && children.iter().all(|c| is_constant_recurse(constants, c)) + // When expression contains branch even if all children are constant + // final result may not be constant + let is_branched = expr.as_any().is::<CaseExpr>(); Review Comment: I don't quite get it. from constantness perspective CaseExpr is nothing special in the issue example we have ``` CASE WHEN name = 'name1' THEN 0.0 WHEN name = 'name2' THEN 0.5 END AS a ``` the `name = 'name1'` is one of the child of CaseExpr and is should not be considered constant. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org