ZhangHuiGui opened a new issue, #40395: URL: https://github.com/apache/arrow/issues/40395
### Describe the bug, including details regarding any error messages, version, and platform. Code like below: ```c const int kCount = 10; auto random_options = RandomOptions::FromSeed(/*seed=*/0); ExecBatch input({}, kCount); ExecBatch input({}, kCount); Expression random_expr = call("random", {}, random_options); ASSERT_OK_AND_ASSIGN(random_expr, random_expr.Bind(float64())); ASSERT_OK_AND_ASSIGN(auto simplify_expr, SimplifyWithGuarantee(random_expr, input.guarantee)); ASSERT_OK_AND_ASSIGN(Datum actual, ExecuteScalarExpression(simplify_expr, input)); // failed ``` Failed with `Invalid: ExecuteScalarExpression cannot Execute non-scalar expression Array[int64]`. It's caused by below codes in `FoldConstans`: https://github.com/apache/arrow/blob/49cdb0fe4e98fda19031c864a18e6156c6edbf3c/cpp/src/arrow/compute/expression.cc#L848C1-L856C10 We should not go into the all_of branch for the call has no arguments, but the `all_of` will return true for this situation. ### Component(s) C++ -- 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: issues-unsubscr...@arrow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org