Skip to content
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

fix: Remove castting on decimals with a small precision to decimal256 #741

Merged
merged 12 commits into from
Aug 1, 2024

Conversation

kazuyukitanimura
Copy link
Contributor

Which issue does this PR close?

Part of #670

Rationale for this change

This PR improves the native execution performance on decimals with a small precision

What changes are included in this PR?

This PR changes not to promote decimal128 to decimal256 if the precisions are small enough

How are these changes tested?

Existing tests

@kazuyukitanimura
Copy link
Contributor Author

OpenJDK 64-Bit Server VM 17.0.11+9-LTS on Mac OS X 14.5
Apple M1 Max
TPCDS Micro Benchmarks:                   Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
add_many_decimals                                 10883          11268         365         26.5          37.8       1.0X
add_many_decimals: Comet (Scan)                   13924          14097         309         20.7          48.3       0.8X
add_many_decimals: Comet (Scan, Exec)             12476          12570         111         23.1          43.3       0.9X

@kazuyukitanimura kazuyukitanimura marked this pull request as ready for review July 30, 2024 16:42
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.75%. Comparing base (ded3dd6) to head (a14f888).
Report is 8 commits behind head on main.

Additional details and impacted files
@@              Coverage Diff              @@
##               main     #741       +/-   ##
=============================================
+ Coverage     33.57%   53.75%   +20.17%     
+ Complexity      830      813       -17     
=============================================
  Files           110      107        -3     
  Lines         42608    10273    -32335     
  Branches       9352     1934     -7418     
=============================================
- Hits          14306     5522     -8784     
+ Misses        25347     3774    -21573     
+ Partials       2955      977     -1978     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andygrove
Copy link
Member

andygrove commented Jul 31, 2024

I created a criterion benchmark for decimal_div in #743.

The results look great for the changes in this PR.

decimal_div             time:   [5.3281 µs 5.3370 µs 5.3485 µs]
                        change: [-94.767% -94.727% -94.685%] (p = 0.00 < 0.05)
                        Performance has improved.

@kazuyukitanimura
Copy link
Contributor Author

Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert on the decimal math in here, but all tests are passing, and performance is improved, so LGTM

@kazuyukitanimura kazuyukitanimura merged commit 25957dd into apache:main Aug 1, 2024
74 checks passed
@kazuyukitanimura
Copy link
Contributor Author

Thank you @andygrove merged

himadripal pushed a commit to himadripal/datafusion-comet that referenced this pull request Sep 7, 2024
…apache#741)

## Which issue does this PR close?

Part of apache#670

## Rationale for this change

This PR improves the native execution performance on decimals with a small precision

## What changes are included in this PR?

This PR changes not to promote decimal128 to decimal256 if the precisions are small enough

## How are these changes tested?

Existing tests

(cherry picked from commit 25957dd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants