Skip to content

Commit 5227fdd

Browse files
authored
GH-47332: [C++][Compute] Fix the issue that the arguments of function call become invalid before wrapping results (#47333)
### Rationale for this change An obvious wrong use of `std::move()`. ### What changes are included in this PR? Remove it. ### Are these changes tested? Yes, by extending the existing test. ### Are there any user-facing changes? None. * GitHub Issue: #47332 Authored-by: Rossi Sun <[email protected]> Signed-off-by: Rossi Sun <[email protected]>
1 parent ddd25d1 commit 5227fdd

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

cpp/src/arrow/compute/expression.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,7 @@ Result<Datum> ExecuteScalarExpression(const Expression& expr, const ExecBatch& i
795795
RETURN_NOT_OK(executor->Init(&kernel_context, {kernel, types, options}));
796796

797797
compute::detail::DatumAccumulator listener;
798-
RETURN_NOT_OK(
799-
executor->Execute(ExecBatch(std::move(arguments), input_length), &listener));
798+
RETURN_NOT_OK(executor->Execute(ExecBatch(arguments, input_length), &listener));
800799
const auto out = executor->WrapResults(arguments, listener.values());
801800
#ifndef NDEBUG
802801
DCHECK_OK(executor->CheckResultType(out, call->function_name.c_str()));

cpp/src/arrow/compute/expression_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -953,13 +953,13 @@ TEST(Expression, ExecuteChunkedArray) {
953953
ExecBatch batch{inputs, 3};
954954

955955
ASSERT_OK_AND_ASSIGN(Datum res, ExecuteScalarExpression(expr, batch));
956+
ASSERT_TRUE(res.is_chunked_array());
956957

957-
AssertDatumsEqual(res, ArrayFromJSON(float64(),
958-
R"([
958+
AssertDatumsEqual(res, ChunkedArrayFromJSON(float64(), {R"([
959959
9.5,
960960
1,
961961
3.75
962-
])"));
962+
])"}));
963963
}
964964

965965
TEST(Expression, ExecuteDictionaryTransparent) {

0 commit comments

Comments
 (0)