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 Fri, 25 Feb 2011 21:15:21 GMT

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

Michael Bouschen commented on JDO-643:
--------------------------------------

Here is the proposed spec change on page 177 of the 3.0 version of the spec. Replace the second
and third paragraph under the headline "Aggregate Types" by:

Sum returns Long for integral types and the field’s type for other Number types (BigDecimal,
Big- Integer, Float, and Double). Avg returns Double. Sum and avg are invalid if applied to
non-Number types.

Min, and max return the type of the expression.


> avg return type
> ---------------
>
>                 Key: JDO-643
>                 URL: https://issues.apache.org/jira/browse/JDO-643
>             Project: JDO
>          Issue Type: Bug
>          Components: specification, tck
>    Affects Versions: JDO 2 maintenance release 2
>            Reporter: Guido Anzuoni
>            Assignee: Michael Bouschen
>             Fix For: JDO 3 maintenance release 1
>
>         Attachments: JDO-643.patch
>
>
> 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.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message