Evgeny Stanilovsky created CALCITE-6190:
-------------------------------------------
Summary: 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
Test highlights the problem :
@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");
}
Throws check 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)