cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nico Haller (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-11485) ArithmeticException in avgFunctionForDecimal
Date Mon, 04 Apr 2016 13:41:25 GMT


Nico Haller commented on CASSANDRA-11485:

Hi Robert, I am able to reproduce this in 3.3

Here would be an easy way to reproduce it (this throws the exception but it also returns the
exception to the client. I am still looking for an easy way to reproduce the non-returning

create table test (bucket int primary key, val decimal);
insert into test (bucket, val) values (1, 0.25);
insert into test (bucket, val) values (2, 0.25);
insert into test (bucket, val) values (3, 0.5);

select avg(val) from test where bucket in (1, 2, 3);
=> ServerError: <ErrorMessage code=0000 [Server error] message="java.lang.ArithmeticException:
Non-terminating decimal expansion; no exact representable decimal result.">

> ArithmeticException in avgFunctionForDecimal
> --------------------------------------------
>                 Key: CASSANDRA-11485
>                 URL:
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL
>            Reporter: Nico Haller
>            Priority: Minor
> I am running into issues when using avg in queries on decimal values.
> It throws an ArithmeticException in org/apache/cassandra/cql3/functions/
(Line 184).
> So whenever an exact representation of the quotient is not possible it will throw that
error and it never returns to the querying client.
> I am not so sure if this is intended behavior or a bug, but in my opinion if an exact
representation of the value is not possible, it should automatically round the value.
> Specifying a rounding mode when calling the divide function should solve the issue

This message was sent by Atlassian JIRA

View raw message