bkietz commented on a change in pull request #10632:
URL: https://github.com/apache/arrow/pull/10632#discussion_r662207074



##########
File path: cpp/src/arrow/compute/exec/expression.h
##########
@@ -131,15 +132,15 @@ inline bool operator!=(const Expression& l, const 
Expression& r) { return !l.Equ
 // Factories
 
 ARROW_EXPORT
-Expression literal(Datum lit);
+Expression literal(Datum&& lit);

Review comment:
       Please revert this; it's not illegal for these factories to accept a 
copy:
   ```c++
   const Datum& copyable = GetDatumRefFromSomewhere();
   Expression expr = literal(copyable);  // will fail to compile if literal() 
only accepts Datum&&
   ```

##########
File path: cpp/src/arrow/compute/exec/expression.cc
##########
@@ -42,18 +42,17 @@ using internal::checked_pointer_cast;
 
 namespace compute {
 
-Expression::Expression(Call call) : 
impl_(std::make_shared<Impl>(std::move(call))) {}
+Expression::Expression(Call&& call) : impl_(std::make_shared<Impl>(call)) {}

Review comment:
       A declaration of `Call&& call` doesn't get automatically moved on the 
first reference expression, so we still need the call to `std::move`
   ```suggestion
   Expression::Expression(Call&& call) : 
impl_(std::make_shared<Impl>(std::move(call))) {}
   ```




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to