You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Tomas Vavricka (Jira)" <ji...@apache.org> on 2025/11/26 14:46:00 UTC

[jira] [Resolved] (QPID-8717) [Broker-J] Broker query engine may produce ClassCastException when using AVG function

     [ https://issues.apache.org/jira/browse/QPID-8717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tomas Vavricka resolved QPID-8717.
----------------------------------
    Resolution: Fixed

> [Broker-J] Broker query engine may produce ClassCastException when using AVG function
> -------------------------------------------------------------------------------------
>
>                 Key: QPID-8717
>                 URL: https://issues.apache.org/jira/browse/QPID-8717
>             Project: Qpid
>          Issue Type: Bug
>          Components: Broker-J
>    Affects Versions: qpid-java-broker-10.0.0
>            Reporter: Daniil Kirilyuk
>            Priority: Minor
>             Fix For: qpid-java-broker-10.0.1
>
>         Attachments: ClassCastException.txt
>
>
> REST API request using AVG aggregate function sometimes returns http 500 server error to client and broker.log records ClassCastException.
> {code:java}
> curl -i -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d \
> '{
>   "sql": "SELECT AVG(queueDepthMessages) AS AverageDepth FROM queue"
> }' \
> http://localhost:8080/api/latest/querybroker/broker {code}
> Error stacktrace: [^ClassCastException.txt]
> *Analysis*
> The issue appears when an avg value is calculated on queues having same depth and therefore returning an integer average value instead of double, e.g. when all queues have zero depth.
> *Implementation*
> The change ensures that the result of the narrowing operation is explicitly converted to double before returning, rather than returning a generic Number. This improves type safety and guarantees the method always returns a Double as intended.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org