[
https://issues.apache.org/jira/browse/CALCITE-7844?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mihai Budiu resolved CALCITE-7844.
----------------------------------
Fix Version/s: 1.43.0
Resolution: Fixed
Fixed in
[https://github.com/apache/calcite/commit/fdabee35b0ab2003c7c1352b83ef28667fcd51c7]
Thank you for the contribution [~alexandrefimov]
> Decimal division scale reduction uses total precision instead of integral
> digits
> --------------------------------------------------------------------------------
>
> Key: CALCITE-7844
> URL: https://issues.apache.org/jira/browse/CALCITE-7844
> Project: Calcite
> Issue Type: Bug
> Reporter: Aleksandr Efimov
> Assignee: Aleksandr Efimov
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.43.0
>
>
> With a custom type system allowing precision and scale 38, DECIMAL(18,6) /
> DECIMAL(18,6) returns DECIMAL(38,6). The documented algorithm implies
> DECIMAL(38,20).
> In RelDataTypeSystem.deriveDecimalDivideType, the scale-reduction condition
> compares total precision with the bound instead of integral digits.
> Reproduced on main c425a5fa0; the same condition exists in 1.42.0. Related:
> CALCITE-6464.
> Correcting the condition also changes default inferred types: 95.0 / 100
> becomes DECIMAL(14,12) instead of DECIMAL(14,6). Incorrect numeric values
> have not been demonstrated.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)