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.
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:
[x] The documentation has been updated, if necessary.
[x] Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
[x] All code follows the
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
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 toValue_Type.Decimal
.Their documentation says:
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: