-
Notifications
You must be signed in to change notification settings - Fork 225
fix: Make cast from float/double to decimal compatible with Spark #1915
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1915 +/- ##
============================================
+ Coverage 56.12% 58.95% +2.83%
- Complexity 976 1141 +165
============================================
Files 119 130 +11
Lines 11743 12863 +1120
Branches 2251 2420 +169
============================================
+ Hits 6591 7584 +993
- Misses 4012 4059 +47
- Partials 1140 1220 +80 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
FWIW there is a - Rust Schubfach create |
Thanks for finding the dragonbox crate @leung-ming. Is there a reason we must add the code to Comet rather than use it as a dependency? |
@parthchandra @andygrove |
@leung-ming do you think the dragonbox module you've implemented can be contributed back to dragonbox? I would feel more confident if someone with a better fundamental understanding of the algorithm reviewed your work. |
I am not implemented a new dragonbox, I just copy it, add 4 |
How about wrapping the c++ reference implementation(decimal interface is public) from the author as a crate? Just like native/hdfs, maybe more reliable and easy to maintain? |
Could this be done in the original crate? I understand that the original point of making the methods private is probably because the algorithm is intended specifically for int/float to string (not decimal) and also because the rust implementation appears to be for the purpose of testing. But if the reference implementation exposes the decimal interface then perhaps the original author might be okay with making the rust methods public too. |
I try it. |
Which issue does this PR close?
Closes #1371
Built on #1914
Rationale for this change
floating-point errors are magnified when casting floating point number to decimal.
openJDK is using an algorithm called Schubfach.
More information about those algorithms could be found in Drachennest.
What changes are included in this PR?
todo
How are these changes tested?
org.apache.comet.CometCastSuite
org.apache.comet.exec.CometAggregateSuite