[
https://issues.apache.org/jira/browse/CASSANDRA-11485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Stupp updated CASSANDRA-11485:
-------------------------------------
Assignee: Robert Stupp
Fix Version/s: 3.0.x
Status: Patch Available (was: Open)
1 divided by 3 - eh, yea.
I've changed the avg() for decimal to use RoundingMode.HALF_EVEN in the patch.
Since we cannot pass a "parameter" to an aggregation (the API doesn't support
that at the moment), the way to use another rounding mode would be to implement
a UDA.
|3.0|[branch|https://github.com/apache/cassandra/compare/cassandra-3.0...snazy:11485-avg-decimal-round-3.0?expand=1]|[testall|http://cassci.datastax.com/view/Dev/view/snazy/job/snazy-11485-avg-decimal-round-3.0-testall/lastBuild/]|[testall|http://cassci.datastax.com/view/Dev/view/snazy/job/snazy-11485-avg-decimal-round-3.0-dtest/lastBuild/]
|trunk|[branch|https://github.com/apache/cassandra/compare/trunk...snazy:11485-avg-decimal-round-trunk?expand=1]|[testall|http://cassci.datastax.com/view/Dev/view/snazy/job/snazy-11485-avg-decimal-round-trunk-testall/lastBuild/]|[testall|http://cassci.datastax.com/view/Dev/view/snazy/job/snazy-11485-avg-decimal-round-trunk-dtest/lastBuild/]
> ArithmeticException in avgFunctionForDecimal
> --------------------------------------------
>
> Key: CASSANDRA-11485
> URL: https://issues.apache.org/jira/browse/CASSANDRA-11485
> Project: Cassandra
> Issue Type: Bug
> Components: CQL
> Reporter: Nico Haller
> Assignee: Robert Stupp
> Priority: Minor
> Fix For: 3.0.x
>
>
> I am running into issues when using avg in queries on decimal values.
> It throws an ArithmeticException in
> org/apache/cassandra/cql3/functions/AggregateFcts.java (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
(v6.3.4#6332)