You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/21 17:22:45 UTC

[GitHub] [arrow-rs] viirya opened a new pull request, #3152: Support decimal negative scale

viirya opened a new pull request, #3152:
URL: https://github.com/apache/arrow-rs/pull/3152

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #1785.
   
   # 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.
   -->
   
   # 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.
   -->
   
   # Are there any user-facing changes?
   
   
   <!--
   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 add the `breaking change` label.
   -->
   


-- 
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-rs] liukun4515 commented on pull request #3152: Support decimal negative scale

Posted by GitBox <gi...@apache.org>.
liukun4515 commented on PR #3152:
URL: https://github.com/apache/arrow-rs/pull/3152#issuecomment-1325080825

   when I first meet the negative scale, I was confused by 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-rs] ursabot commented on pull request #3152: Support decimal negative scale

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #3152:
URL: https://github.com/apache/arrow-rs/pull/3152#issuecomment-1325508273

   Benchmark runs are scheduled for baseline = 6c466afe3b0b3a4c7b90c99c27eefade62011c31 and contender = 78ab0ef3f6f422fd4b79a29504f0274220aaf74b. 78ab0ef3f6f422fd4b79a29504f0274220aaf74b is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/46f6ef3ec2a54fd093835ddff8da254b...589f3b4d43be48f786d9e0baad93fe95/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/98567f0d5b5a4c2ba10e890aec2871cd...c7c414319cab4fa3b18de78208373d26/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/c8d8f69da19d47d3a18fb4b0aab025ab...53339077c1bb42bdbab037c22baaae86/)
   [Skipped :warning: Benchmarking of arrow-rs-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/844935ad59a445d59d82765f6e0af6bb...37b0ea2e9b0143f6be25c7a2529d935a/)
   Buildkite builds:
   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-rs] tustvold commented on a diff in pull request #3152: Support decimal negative scale

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #3152:
URL: https://github.com/apache/arrow-rs/pull/3152#discussion_r1029064164


##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -1039,7 +1039,14 @@ impl<T: DecimalType + ArrowPrimitiveType> PrimitiveArray<T> {
                 Decimal128Type::MAX_SCALE
             )));
         }
-        if scale > precision {
+        if scale < -T::MAX_SCALE {

Review Comment:
   I wasn't sure about this, as the rationale for enforcing the upper limit is if the positive scale exceeds the precision it would result in truncation. I'm not sure this applies to the negative direction. However, the C++ version has this same check, so :shrug:  - https://github.com/apache/arrow/blob/91ee6dad722ee154d63eea86ce5644e1e658b53b/cpp/src/arrow/util/decimal.cc#L389
   
   



-- 
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-rs] viirya commented on pull request #3152: Support decimal negative scale

Posted by GitBox <gi...@apache.org>.
viirya commented on PR #3152:
URL: https://github.com/apache/arrow-rs/pull/3152#issuecomment-1324450259

   > I think we probably want to do a quick parse over the codebase for places that assume the scale is unsigned.
   > 
   > Doing a search for `scale as` shows a couple of `scale as usize` which are likely incorrect
   
   These `scale as usize` in `format_decimal_str` should be safe as negative case is handled in advance.
   
   Other `scale as` usages include some in csv reader (`scale as u8` and `scale as u32`), and the scale is from parsing. I think it is safe because we cannot parse a negative scale.
   
   Another two is `scale as i32` in ipc when passing i8 scale to i32 into ipc `DecimalBuilder`. This should be safe too.
   
   The problematic one is to convert `scale` to u32 in `cast_integer_to_decimal`. I'm fixing it and will add one 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-rs] viirya merged pull request #3152: Support decimal negative scale

Posted by GitBox <gi...@apache.org>.
viirya merged PR #3152:
URL: https://github.com/apache/arrow-rs/pull/3152


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