[
https://issues.apache.org/jira/browse/IGNITE-17438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ivan Gagarkin updated IGNITE-17438:
-----------------------------------
Affects Version/s: 2.14
> Unable to sum decimal values which have non-default precision
> -------------------------------------------------------------
>
> Key: IGNITE-17438
> URL: https://issues.apache.org/jira/browse/IGNITE-17438
> Project: Ignite
> Issue Type: Bug
> Affects Versions: 2.14
> Reporter: Ivan Gagarkin
> Priority: Critical
>
> Version: the current master branch
> Found the bug when creating unit tests.
> Steps to reproduce:
> {code:java}
> cache.query(new SqlFieldsQuery(
> """
> | CREATE TABLE numbers (
> | id LONG,
> | val DOUBLE,
> | int_val LONG,
> | decimal_val DECIMAL(5, 5),
> | PRIMARY KEY (id)) WITH "backups=1"
> """.stripMargin)).getAll
> cache.query(qry.setArgs(18L.asInstanceOf[JLong], new
> java.math.BigDecimal(2.5))).getAll
> cache.query(qry.setArgs(19L.asInstanceOf[JLong], new
> java.math.BigDecimal(3.5))).getAll
> cache.query(qry.setArgs(20L.asInstanceOf[JLong], new
> java.math.BigDecimal(4.5))).getAll
> cache.query(qry.setArgs(21L.asInstanceOf[JLong], new
> java.math.BigDecimal(4.5))).getAll
> cache.query(new SqlFieldsQuery("SELECT SUM(decimal_val) FROM numbers WHERE id
> IN (18, 19, 20)")).getAll{code}
> Result:
> {code:java}
> class org.apache.ignite.internal.processors.query.IgniteSQLException: Numeric
> value out of range: "5"; SQL statement:
> SELECT
> CAST(CAST(SUM(__C0_0) AS DECIMAL(5, 5)) AS DECIMAL(5, 5)) __C0_0
> FROM PUBLIC.__T0 [22003-197] {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)