You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++] Expression ExecuteScalarExpression execute empty args function with a wrong result #39860
Describe the bug, including details regarding any error messages, version, and platform.
Problem
We have some arrow-builtin functions with no arguments support, like random/count_all/hash_count_all.
When we use call("random", {}, opts) and execute the expression with ExecuteScalarExpression(random_expr, cp::ExecBatch({}, 10)), the result only output one row. What we expected is 10 rows array.
[
0.5353881964857193
]
Reproduce
TEST(Expression, ExprWithNoArguments) {
auto random_options=RandomOptions::FromSeed(/*seed=*/0);
auto expr=call("random", {}, random_opts);
ASSERT_OK_AND_ASSIGN(expr, expr.Bind(arrow::float64()));
ASSERT_OK_AND_ASSIGN(autoout, ExecuteScalarExpression(
expr, ExecBatch({}, 10)));
std::cout << out.make_array()->ToString() << std::endl; // expect 10 rows but only get 1 row
}
Reason
The ExecuteScalarExpression internal code do some checks like below:
boolall_scalar= true;
for (size_ti=0; i<arguments.size(); ++i) {
ARROW_ASSIGN_OR_RAISE(
arguments[i], ExecuteScalarExpression(call->arguments[i], input, exec_context));
if (arguments[i].is_array()) {
all_scalar= false;
}
}
The all_scalar will decide the output rows, if all_scalar is true, only output 1 row.
So we should consider the empty function arguments here? Or i missed some background here?
Activity
close apacheGH-39860
GH-39860: [C++] Expression ExecuteScalarExpression execute empty args…
apacheGH-39860: [C++] Expression ExecuteScalarExpression execute empt…
GH-39860: [C++] Expression ExecuteScalarExpression execute empty args…
apacheGH-39860: [C++] Expression ExecuteScalarExpression execute empt…