bkietz commented on code in PR #40396:
URL: https://github.com/apache/arrow/pull/40396#discussion_r1517729718


##########
cpp/src/arrow/compute/expression.cc:
##########
@@ -845,7 +845,8 @@ Result<Expression> FoldConstants(Expression expr) {
       std::move(expr), [](Expression expr) { return expr; },
       [](Expression expr, ...) -> Result<Expression> {
         auto call = CallNotNull(expr);
-        if (std::all_of(call->arguments.begin(), call->arguments.end(),
+        if (!call->arguments.empty() &&

Review Comment:
   There could be *pure* functions called with zero arguments, in which case 
constant folding would not be incorrect. I think the better fix here is to add 
a `Function::is_impure()` property (defaults to `false`, overridden to return 
`true` for random). For impure functions, we should probably skip any 
simplification of the call itself (but simplifying its arguments should be fine)



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

Reply via email to