db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Bouschen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JDO-643) avg return type
Date Mon, 13 Dec 2010 13:26:03 GMT

    [ https://issues.apache.org/jira/browse/JDO-643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12970806#action_12970806

Michael Bouschen commented on JDO-643:

I agree, avg(expression) should return
- Double for integral types (byte, short, int, long), float, double and their wrapper classes
- BigDecimal for BigInteger and BigDecimal

Two remarks:
- We need to point out that this is an incompatible change, meaning a valid JDO 3.0 query
might run into a RuntimeException.
- JPA always uses Double as return type  

> avg return type
> ---------------
>                 Key: JDO-643
>                 URL: https://issues.apache.org/jira/browse/JDO-643
>             Project: JDO
>          Issue Type: Bug
>          Components: specification
>    Affects Versions: JDO 2 maintenance release 2
>            Reporter: Guido Anzuoni
>            Assignee: Michael Bouschen
>             Fix For: JDO 3 maintenance release 1
> Aggregate type specification at page 175 claims that avg(expression) return type is the
same of the enclosed expression.
> This is wrong from a strictly mathematical point of view.
> In fact, if you select an avg on an int field member the result is truncated.
> The result type should always be double.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message