enso-org / enso

Hybrid visual and textual functional programming.
https://enso.org
Apache License 2.0
7.34k stars 323 forks source link

Use `NUMBER(38, 12)` as default range for Snowflake `DECIMAL`s #10971

Closed GregoryTravis closed 3 weeks ago

GregoryTravis commented 1 month ago

Closes #10942.

Snowflake's DECIMAL/NUMBER types do not have a very large dynamic range, but we must specify default values for precision and scale, or it will always round values to 0 decimal places when casting to Value_Type.Decimal.

Their documentation says:

Snowflake minimizes potential overflow in the output (due to chained division) and loss of scale by adding 6 digits to the scale of the numerator, up to a maximum threshold of 12 digits, unless the scale of the numerator is larger than 12, in which case the numerator scale is used as the output scale.

Using NUMBER(38, 12) by default will let us use all of the available fidelity in arithmetic operations while giving as much precision as possible, so it seems like a good default.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

GregoryTravis commented 1 month ago

Will schedule a Snowflake CI run.