You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "icexelloss (via GitHub)" <gi...@apache.org> on 2023/03/29 18:36:39 UTC

[GitHub] [arrow] icexelloss opened a new pull request, #34777: MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExt…

icexelloss opened a new pull request, #34777:
URL: https://github.com/apache/arrow/pull/34777

   …ensionEmit
   
   
   <!--
   Thanks for opening a pull request!
   If this is your first pull request you can find detailed information on how 
   to contribute here:
     * [New Contributor's Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
     * [Contributing Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
   
   
   If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
   
   Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
   
   Then could you also rename the pull request title in the following format?
   
       GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   In the case of PARQUET issues on JIRA the title also supports:
   
       PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   -->
   
   ### Rationale for this change
   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.
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   ### What changes are included in this PR?
   Removed `std::move` when calling `ProcessEmit` and `ProcessExtensionEmit`
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ### Are these changes tested?
   With existing tests
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   ### Are there any user-facing changes?
   No
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please uncomment the line below and explain which changes are breaking.
   -->
   <!-- **This PR includes breaking changes to public APIs.** -->
   
   <!--
   Please uncomment the line below (and provide explanation) if the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld). We use this to highlight fixes to issues that may affect users without their knowledge. For this reason, fixing bugs that cause errors don't count, since those are usually obvious.
   -->
   <!-- **This PR contains a "Critical Fix".** -->


-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] icexelloss commented on pull request #34777: MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit

Posted by "icexelloss (via GitHub)" <gi...@apache.org>.
icexelloss commented on PR #34777:
URL: https://github.com/apache/arrow/pull/34777#issuecomment-1490438099

   @westonpace Minor changes to clean up the code a bit - no rush


-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] icexelloss commented on a diff in pull request #34777: MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit

Posted by "icexelloss (via GitHub)" <gi...@apache.org>.
icexelloss commented on code in PR #34777:
URL: https://github.com/apache/arrow/pull/34777#discussion_r1153375391


##########
cpp/src/arrow/engine/substrait/relation_internal.cc:
##########
@@ -89,7 +89,7 @@ Result<EmitInfo> GetEmitInfo(const RelMessage& rel,
   }
   emit_info.expressions = std::move(proj_field_refs);
   emit_info.schema = schema(std::move(emit_fields));
-  return std::move(emit_info);

Review Comment:
   I don't think std::move of return value is good practice. (Since this prevents NRVO) so I removed them here.



-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] westonpace merged pull request #34777: MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit

Posted by "westonpace (via GitHub)" <gi...@apache.org>.
westonpace merged PR #34777:
URL: https://github.com/apache/arrow/pull/34777


-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] icexelloss commented on a diff in pull request #34777: MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit

Posted by "icexelloss (via GitHub)" <gi...@apache.org>.
icexelloss commented on code in PR #34777:
URL: https://github.com/apache/arrow/pull/34777#discussion_r1158862830


##########
cpp/src/arrow/engine/substrait/relation_internal.cc:
##########
@@ -89,7 +89,7 @@ Result<EmitInfo> GetEmitInfo(const RelMessage& rel,
   }
   emit_info.expressions = std::move(proj_field_refs);
   emit_info.schema = schema(std::move(emit_fields));
-  return std::move(emit_info);

Review Comment:
   Got it. I reverted this.



-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] icexelloss commented on a diff in pull request #34777: MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit

Posted by "icexelloss (via GitHub)" <gi...@apache.org>.
icexelloss commented on code in PR #34777:
URL: https://github.com/apache/arrow/pull/34777#discussion_r1153374376


##########
cpp/src/arrow/engine/substrait/expression_internal.h:
##########
@@ -39,11 +39,6 @@ ARROW_ENGINE_EXPORT
 Result<FieldRef> DirectReferenceFromProto(const substrait::Expression::FieldReference*,
                                           const ExtensionSet&, const ConversionOptions&);
 
-ARROW_ENGINE_EXPORT

Review Comment:
   Per this comment:
   https://github.com/apache/arrow/pull/34627#discussion_r1152715709
   
   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.



-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] westonpace commented on a diff in pull request #34777: MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit

Posted by "westonpace (via GitHub)" <gi...@apache.org>.
westonpace commented on code in PR #34777:
URL: https://github.com/apache/arrow/pull/34777#discussion_r1154712765


##########
cpp/src/arrow/engine/substrait/expression_internal.h:
##########
@@ -39,11 +39,6 @@ ARROW_ENGINE_EXPORT
 Result<FieldRef> DirectReferenceFromProto(const substrait::Expression::FieldReference*,
                                           const ExtensionSet&, const ConversionOptions&);
 
-ARROW_ENGINE_EXPORT

Review Comment:
   +1



-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] ursabot commented on pull request #34777: MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit

Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #34777:
URL: https://github.com/apache/arrow/pull/34777#issuecomment-1502748729

   Benchmark runs are scheduled for baseline = 2fe17338e2d1f85d0c2685d31d2dd51f138b6b80 and contender = a7c4e05adee7a568710ad0f62198a9614c0c9594. a7c4e05adee7a568710ad0f62198a9614c0c9594 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/5844ecd00d4344a78e604ca6c1ad79be...21c6a76563e1419b9c2f4357db177b18/)
   [Finished :arrow_down:1.25% :arrow_up:0.03%] [test-mac-arm](https://conbench.ursa.dev/compare/runs/92ff8c2e5f3b4d35a3f4a6562acc68a1...f3f05965eae14dbca934dd21534dca74/)
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/78e9a4b91d2a49608a63eac6daa74a50...839ca730c9854d4aa77eaae14138c9f6/)
   [Finished :arrow_down:0.37% :arrow_up:0.03%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/7e089c8bbec5480e9afd57aad7a4bf20...09e86445764341e7a434b92108977c0d/)
   Buildkite builds:
   [Finished] [`a7c4e05a` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2667)
   [Finished] [`a7c4e05a` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/2700)
   [Finished] [`a7c4e05a` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2665)
   [Finished] [`a7c4e05a` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2691)
   [Finished] [`2fe17338` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2666)
   [Finished] [`2fe17338` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/2699)
   [Finished] [`2fe17338` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2664)
   [Finished] [`2fe17338` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2690)
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] westonpace commented on a diff in pull request #34777: MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit

Posted by "westonpace (via GitHub)" <gi...@apache.org>.
westonpace commented on code in PR #34777:
URL: https://github.com/apache/arrow/pull/34777#discussion_r1154711477


##########
cpp/src/arrow/engine/substrait/relation_internal.cc:
##########
@@ -89,7 +89,7 @@ Result<EmitInfo> GetEmitInfo(const RelMessage& rel,
   }
   emit_info.expressions = std::move(proj_field_refs);
   emit_info.schema = schema(std::move(emit_fields));
-  return std::move(emit_info);

Review Comment:
   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`.



-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] icexelloss commented on pull request #34777: MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit

Posted by "icexelloss (via GitHub)" <gi...@apache.org>.
icexelloss commented on PR #34777:
URL: https://github.com/apache/arrow/pull/34777#issuecomment-1497666792

   > 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).
   
   Got it. I do see in other places where `std::move` is used for return. I guess it is a larger scope discussion whether we want to change that or not. Will revert that part.


-- 
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-unsubscribe@arrow.apache.org

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