-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add truncate(x,n) presto function #2887
Comments
@gosharz are you going to be working on this Issue as well? |
Catching up with @mbasmanova: it looks we need to have a closer look at the ways to properly mimick the Java implementation. Main reasons:
Adding references we've collected so far on the 1st point:
|
From https://prestodb.io/docs/current/language/types.html#decimal:
Wondering if using one of the above libraries with maximal precision to match type boundaries will guarantee full parity. |
From https://en.wikipedia.org/wiki/Floating-point_arithmetic:
|
Per #2892 |
Context: of #2262
Presto supports two versions of truncate: truncate(x) and truncate(x,n). The former one has been added per #2862. This issue add adding implementation for the second overload.
Here is the java reference implementation which must be mimicked:
https://github.com/prestodb/presto/blob/ff412ef4b745eb31549cc0abe25e885a63875f58/presto-main/src/main/java/com/facebook/presto/operator/scalar/MathFunctions.java#L365
BigDecimal setScale - https://github.com/openjdk-mirror/jdk7u-jdk/blob/f4d80957e89a19a29bb9f9807d2a28351ed7f7df/src/share/classes/java/math/BigDecimal.java#L2378
The text was updated successfully, but these errors were encountered: