[
https://issues.apache.org/jira/browse/JDO-643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972578#action_12972578
]
Craig L Russell commented on JDO-643:
-------------------------------------
What about the case where the JDO implementation lets the database perform the
avg function? If the database always returns a double value anyway, are we
kidding ourselves that the result is actually a BigDecimal? What should the
precision be in this case?
Obviously, either the user or the implementation could take a double result and
convert it into a BigDecimal. Is there a good reason why BigDecimal is
preferable to return to the user instead of double? Would a user expect the
result to be BigDecimal (without reading the JDO specification carefully)?
Is there a good enough reason for JDO to be different from JPA in this case?
> 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
>
> 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.
-
You can reply to this email to add a comment to the issue online.