[
https://issues.apache.org/jira/browse/CALCITE-6190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mihai Budiu resolved CALCITE-6190.
----------------------------------
Fix Version/s: 1.37.0
Resolution: Fixed
Fixed in
https://github.com/apache/calcite/commit/135e96383294f60bacf2bdc0f83ab5389fa77115
> Incorrect precision derivation for negative numeric types
> ---------------------------------------------------------
>
> Key: CALCITE-6190
> URL: https://issues.apache.org/jira/browse/CALCITE-6190
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.36.0
> Reporter: Evgeny Stanilovsky
> Assignee: Mihai Budiu
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.37.0
>
>
> Test highlights the problem :
> {code:java}
> @Test void testTypeOfAs() {
> sql("select DECIMAL '100.01' as c1 from (values (true))")
> .columnType("DECIMAL(5, 2) NOT NULL");
> sql("select DECIMAL '-100.01' as c1 from (values (true))")
> .columnType("DECIMAL(5, 2) NOT NULL");
> }
> {code}
> Throws exception for second expression:
> {noformat}
> Expected: is "DECIMAL(5, 2) NOT NULL"
> but: was "DECIMAL(6, 2) NOT NULL"
> {noformat}
> Seems root cause in SqlLiteral#createExactNumeric precision derivation not
> consider negative numbers.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)