bkietz commented on code in PR #40396:
URL: https://github.com/apache/arrow/pull/40396#discussion_r1519826972
##########
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:
> So maybe we can implement is_impure property by return
Function::arity().num_args == 0 && Function::arity().is_varargs == false rather
than overridden for every impure function?
I don't think that's viable; for example there may be a UDF which is impure
but still takes arguments.
> There could be `pure` functions called with zero arguments
For example, a UDF `third_party_magic_number()` which takes no arguments but
always returns a compile time constant is pure since the return value is
identical for identical arguments. In this example, we should be able to fold
the filter expression `add(third_party_magic_number(), 42) >= 777` into a
boolean scalar, potentially skipping a lot of scanning
--
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]