[
https://issues.apache.org/jira/browse/IGNITE-23170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pavel Tupitsyn updated IGNITE-23170:
------------------------------------
Summary: SQL returns huge decimal values with trailing zeros (was:
BinaryTupleCommon.shrinkDecimal is too slow)
> SQL returns huge decimal values with trailing zeros
> ---------------------------------------------------
>
> Key: IGNITE-23170
> URL: https://issues.apache.org/jira/browse/IGNITE-23170
> Project: Ignite
> Issue Type: Bug
> Components: binary
> Reporter: Pavel Tupitsyn
> Assignee: Pavel Tupitsyn
> Priority: Major
> Labels: ignite-3
> Fix For: 3.0
>
>
> Add the following code to *ItSqlApiBaseTest*
> {code:java}
> @Test
> public void testDecimalDivisionTimeout() {
> IgniteSql igniteSql = igniteSql();
> igniteSql.execute(null, "CREATE TABLE testDecimalDivisionTimeout (ID
> INT PRIMARY KEY, VAL0 INT)").close();
> for (int i = 0; i < 10; i++) {
> igniteSql.execute(null, "INSERT INTO testDecimalDivisionTimeout
> VALUES (?, ?)", i, i * 100).close();
> }
> ResultSet<SqlRow> cursor = igniteSql.execute(null,
> "SELECT cast(VAl0 as decimal(300)) / ? FROM
> testDecimalDivisionTimeout", new BigDecimal(200));
> while (cursor.hasNext()) {
> cursor.next();
> }
> }
> {code}
> Warnings in the log:
> {code}
> org.apache.ignite.lang.IgniteException: A critical thread is blocked for 1758
> ms that is more than the allowed 500 ms, it is "iscsat_n_0-client-12" prio=10
> Id=121 RUNNABLE
> at
> [email protected]/java.math.MutableBigInteger.divideOneWord(MutableBigInteger.java:1131)
> at
> [email protected]/java.math.MutableBigInteger.divideKnuth(MutableBigInteger.java:1203)
> at
> [email protected]/java.math.MutableBigInteger.divideKnuth(MutableBigInteger.java:1163)
> at
> [email protected]/java.math.BigInteger.divideAndRemainderKnuth(BigInteger.java:2328)
> at
> [email protected]/java.math.BigInteger.divideAndRemainder(BigInteger.java:2316)
> at
> [email protected]/java.math.BigDecimal.createAndStripZerosToMatchScale(BigDecimal.java:4878)
> at
> [email protected]/java.math.BigDecimal.stripTrailingZeros(BigDecimal.java:3053)
> at
> app//org.apache.ignite.internal.binarytuple.BinaryTupleCommon.shrinkDecimal(BinaryTupleCommon.java:118)
> at
> app//org.apache.ignite.internal.binarytuple.BinaryTupleBuilder.appendDecimalNotNull(BinaryTupleBuilder.java:292)
> at
> app//org.apache.ignite.internal.binarytuple.BinaryTupleBuilder.appendDecimal(BinaryTupleBuilder.java:317)
> at
> app//org.apache.ignite.client.handler.requests.sql.ClientSqlCommon.packValue(ClientSqlCommon.java:96)
> at
> app//org.apache.ignite.client.handler.requests.sql.ClientSqlCommon.packCurrentPage(ClientSqlCommon.java:48)
> at
> app//org.apache.ignite.client.handler.requests.sql.ClientSqlExecuteRequest.writeResultSetAsync(ClientSqlExecuteRequest.java:135)
> at
> app//org.apache.ignite.client.handler.requests.sql.ClientSqlExecuteRequest.lambda$process$0(ClientSqlExecuteRequest.java:93)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)