You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "js8544 (via GitHub)" <gi...@apache.org> on 2023/05/26 11:59:47 UTC

[GitHub] [arrow] js8544 opened a new pull request, #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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

   <!--
   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
   
   <!--
    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.  
   -->
   
   There are two variants of cumsum, `cumulative_sum` always wraps around on overflow and `cumulative_sum` always return `Status::Invalid` on overflow, regardless of the `check_overflow` parameter in CumulativeSumOptions.
   For example:
   ```cpp
   CumulativeSumOptions options(/*start=*/0, /*skip_nulls=*/true, /*check_overflow=*/true);
   auto res = CallFunction("cumulative_sum", {ArrayFromJSON(int8(), "[127, 1]")}, &options);
   std::cout << res->make_array()->ToString() << std::endl;
   // prints [127, -128], but user might expect an error returned.
   ```
   
   I believe it's more of a ambiguity rather than a bug. The document of `cumulative_sum` also doesn't memtion `check_overflow` at all, and `check_overflow` is not exposed to pyarrow. So IMO the best approach to avoid confusion is to remove `check_overflow` from CumulativeSumOptions.
   
   The only place where `check_overflow` is used is in the convenience function `CumulativeSum` defined in api_vector.h, which calls `cumulative_sum_checked` or `cumulative_sum` depending on the parameter. It can be replaced by a bool parameter in the convenience function.
   
   ### What changes are included in this PR?
   
   <!--
   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.
   -->
   
   1. `check_overflow` is removed from CumulativeSumOptions.
   2. Add a bool check_overflow parameter to the C++ convenience function CumulativeSum.
   
   ### Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   4. 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)?
   -->
   
   It doesn't affect the current tests.
   
   ### Are there any user-facing changes?
   
   Yes, but only the C++ convenience function because check_overflow is not used in the kernel implementation and not exposed to pyarrow anyways.
   
   <!--
   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] js8544 commented on pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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

   The CI failure looks weird. I pushed an empty commit to trigger a rerun.


-- 
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] pitrou commented on pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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

   The CI failure was probably unrelated, but let's wait for it.


-- 
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] github-actions[bot] commented on pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35790:
URL: https://github.com/apache/arrow/pull/35790#issuecomment-1564283875

   * Closes: #35789


-- 
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] pitrou commented on pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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

   Regardless, the unused option is misleading, so I agree with removing it.


-- 
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] pitrou commented on a diff in pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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


##########
cpp/src/arrow/compute/api_vector.h:
##########
@@ -601,7 +596,7 @@ ARROW_EXPORT
 Result<Datum> CumulativeSum(
     const Datum& values,
     const CumulativeSumOptions& options = CumulativeSumOptions::Defaults(),
-    ExecContext* ctx = NULLPTR);
+    bool check_overflow = false, ExecContext* ctx = NULLPTR);

Review Comment:
   Can you document the  additional param in the docstring above?
   Also, can you add a small test that the param is taken into account?



-- 
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 #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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

   Benchmark runs are scheduled for baseline = e0fd7ef8f16a913913bba706c396f424fba1583a and contender = d20a1d1e1dde4d1a73d5e856a2d06dd5139468dc. d20a1d1e1dde4d1a73d5e856a2d06dd5139468dc 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/357d2fba2ae647b2a7764e7e6caeb91b...df5596113c724a9fa5b56dc43f521c66/)
   [Finished :arrow_down:0.41% :arrow_up:0.0%] [test-mac-arm](https://conbench.ursa.dev/compare/runs/d3adc704214844149419cb2e3154a327...ace1efd466fa41e68adbe341ea95b9db/)
   [Finished :arrow_down:5.56% :arrow_up:0.0%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/ad981000c2f54fa4bf34f42ea37e41ed...fdf0948774e54bdaa7808608ee60421a/)
   [Finished :arrow_down:0.63% :arrow_up:0.06%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/831458cedb5a4e7fbdf9d2ff777d9036...31b2b042fd3648fc8774e6b4ad1a66cb/)
   Buildkite builds:
   [Finished] [`d20a1d1e` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2968)
   [Finished] [`d20a1d1e` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/3004)
   [Finished] [`d20a1d1e` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2969)
   [Finished] [`d20a1d1e` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2994)
   [Finished] [`e0fd7ef8` ec2-t3-xlarge-us-east-2](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/2967)
   [Finished] [`e0fd7ef8` test-mac-arm](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/3003)
   [Finished] [`e0fd7ef8` ursa-i9-9960x](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/2968)
   [Finished] [`e0fd7ef8` ursa-thinkcentre-m75q](https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/2993)
   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] ursabot commented on pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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

   ['Python', 'R'] benchmarks have high level of regressions.
   [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/ad981000c2f54fa4bf34f42ea37e41ed...fdf0948774e54bdaa7808608ee60421a/)
   


-- 
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] github-actions[bot] commented on pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35790:
URL: https://github.com/apache/arrow/pull/35790#issuecomment-1564283934

   :warning: GitHub issue #35789 **has been automatically assigned in GitHub** to PR creator.


-- 
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] js8544 commented on a diff in pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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


##########
cpp/src/arrow/compute/api_vector.h:
##########
@@ -601,7 +596,7 @@ ARROW_EXPORT
 Result<Datum> CumulativeSum(
     const Datum& values,
     const CumulativeSumOptions& options = CumulativeSumOptions::Defaults(),
-    ExecContext* ctx = NULLPTR);
+    bool check_overflow = false, ExecContext* ctx = NULLPTR);

Review Comment:
   There was no doc for CumulativeSum above... But I added one anyways.
   Also added a small test.



-- 
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] js8544 commented on a diff in pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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


##########
cpp/src/arrow/compute/api_vector.h:
##########
@@ -601,7 +596,7 @@ ARROW_EXPORT
 Result<Datum> CumulativeSum(
     const Datum& values,
     const CumulativeSumOptions& options = CumulativeSumOptions::Defaults(),
-    ExecContext* ctx = NULLPTR);
+    bool check_overflow = false, ExecContext* ctx = NULLPTR);

Review Comment:
   There were no doc for CumulativeSum above... But I added one anyways.
   Also added a small test.



-- 
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] js8544 commented on pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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

   > > There are two variants of cumsum, `cumulative_sum` always wraps around on overflow and `cumulative_sum` always return `Status::Invalid` on overflow,
   > 
   > This does not seem to make sense to me, is there a typo?
   
   Sorry! It's a typo indeed. I meant `cumulative_sum_checked`.


-- 
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] pitrou commented on pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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

   > There are two variants of cumsum, `cumulative_sum` always wraps around on overflow and `cumulative_sum` always return `Status::Invalid` on overflow,
   
   This does not seem to make sense to me, is there a typo?
   


-- 
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] pitrou merged pull request #35790: GH-35789: [C++] Remove check_overflow from CumulativeSumOptions

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


-- 
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