-
Notifications
You must be signed in to change notification settings - Fork 4k
MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit #34777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e00d5e5 to
fb49302
Compare
| Result<FieldRef> DirectReferenceFromProto(const substrait::Expression::FieldReference*, | ||
| const ExtensionSet&, const ConversionOptions&); | ||
|
|
||
| ARROW_ENGINE_EXPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per this comment:
#34627 (comment)
I noticed and removed it here. Although unrelated to the original PR, I figured this is small enough change to piggy back here. If there are objection I can revert this change and put in separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
| } | ||
| emit_info.expressions = std::move(proj_field_refs); | ||
| emit_info.schema = schema(std::move(emit_fields)); | ||
| return std::move(emit_info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think std::move of return value is good practice. (Since this prevents NRVO) so I removed them here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recall that one of the older compilers (I think mingw) does not recognize that emit_info is the return value because the return type is Result<EmitInfo> and the type of emit_info is EmitInfo. See, for example, https://stackoverflow.com/questions/74459462/why-c-does-not-perform-rvo-to-stdoptional . However, maybe it was one of the older gcc compilers that we no longer support now that we upgraded to C++17.
We should detect it, if it is a problem, if the nightly tests pass. However, the existing convention in the code base is still to use std::move when the return type is Result<T> and the object is T.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I reverted this.
|
@westonpace Minor changes to clean up the code a bit - no rush |
westonpace
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I definitely agree with removing std::move when calling ProcessEmit. I'm not sure about the return statement though (see my reply to your comment).
| Result<FieldRef> DirectReferenceFromProto(const substrait::Expression::FieldReference*, | ||
| const ExtensionSet&, const ConversionOptions&); | ||
|
|
||
| ARROW_ENGINE_EXPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Got it. I do see in other places where |
b49f836 to
e5c2118
Compare
westonpace
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cleanup.
|
Benchmark runs are scheduled for baseline = 2fe1733 and contender = a7c4e05. a7c4e05 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
…ensionEmit (apache#34777) ### Rationale for this change I noticed a few places in relation_internal.cc that std::move is used incorrectly. ### What changes are included in this PR? * Currently, `std::move` is used when passing arguments to `ProcessEmit` and `ProcessExtensionEmit`, however these two methods takes in const reference and therefore the `std::move` is not needed. * (orthogonal) Removed unneeded `FromProto` from header ### Are these changes tested? With existing tests ### Are there any user-facing changes? No Authored-by: Li Jin <ice.xelloss@gmail.com> Signed-off-by: Weston Pace <weston.pace@gmail.com>
…ensionEmit (apache#34777) ### Rationale for this change I noticed a few places in relation_internal.cc that std::move is used incorrectly. ### What changes are included in this PR? * Currently, `std::move` is used when passing arguments to `ProcessEmit` and `ProcessExtensionEmit`, however these two methods takes in const reference and therefore the `std::move` is not needed. * (orthogonal) Removed unneeded `FromProto` from header ### Are these changes tested? With existing tests ### Are there any user-facing changes? No Authored-by: Li Jin <ice.xelloss@gmail.com> Signed-off-by: Weston Pace <weston.pace@gmail.com>
Rationale for this change
I noticed a few places in relation_internal.cc that std::move is used incorrectly.
What changes are included in this PR?
std::moveis used when passing arguments toProcessEmitandProcessExtensionEmit, however these two methods takes in const reference and therefore thestd::moveis not needed.FromProtofrom headerAre these changes tested?
With existing tests
Are there any user-facing changes?
No