[
https://issues.apache.org/jira/browse/CASSANDRA-11485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15224172#comment-15224172
]
Nico Haller commented on CASSANDRA-11485:
-----------------------------------------
Sorry, forgot the actual server log:
java.lang.ArithmeticException: Non-terminating decimal expansion; no exact
representable decimal result.
at java.math.BigDecimal.divide(BigDecimal.java:1690) ~[na:1.8.0_74]
at
org.apache.cassandra.cql3.functions.AggregateFcts$3$1.compute(AggregateFcts.java:184)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.cql3.selection.AggregateFunctionSelector.getOutput(AggregateFunctionSelector.java:52)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.cql3.selection.Selection$SelectionWithProcessing$1.getOutputRow(Selection.java:556)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.cql3.selection.Selection$ResultSetBuilder.getOutputRow(Selection.java:369)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.cql3.selection.Selection$ResultSetBuilder.build(Selection.java:357)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.cql3.statements.SelectStatement.pageAggregateQuery(SelectStatement.java:379)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:330)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:214)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:76)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:206)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:237)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:222)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:115)
~[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:507)
[apache-cassandra-3.3.jar:3.3]
at
org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:401)
[apache-cassandra-3.3.jar:3.3]
at
io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
at
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
at
io.netty.channel.AbstractChannelHandlerContext.access$700(AbstractChannelHandlerContext.java:32)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
at
io.netty.channel.AbstractChannelHandlerContext$8.run(AbstractChannelHandlerContext.java:324)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[na:1.8.0_74]
at
org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:164)
[apache-cassandra-3.3.jar:3.3]
at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:105)
[apache-cassandra-3.3.jar:3.3]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_74]
> 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
> 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/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)