[
https://issues.jboss.org/browse/TEIID-1600?page=com.atlassian.jira.plugin...
]
Steven Hawkins resolved TEIID-1600.
-----------------------------------
Resolution: Done
Updated the parsing and AVG (with a minor optimization) logic to appropriately return
exact numeric values. Also updated the release notes.
Some backwards compatibility is offered by setting the system property
org.teiid.parseDecimalAsDouble to true, but there is no switch to change the AVG behavior
- as it is unlikely that anyone will want the previous behavior. If needed the
org.teiid.parseDecimalAsDouble could be expanded to make AVG backwards compatible as
well.
The resolver is also now more flexible with literal values used as arguments to functions
- e.g. dayName('2001-01-01') does not require an explicit convert. This also
ensures that literals parsed as bigdecimal will automatically be converted to double if
required by the surrounding function.
However there may be many situations where view definitions will need to be updated since
we require the types to match. The only way for this not to cause issues is to allow the
view resolution logic to introduce conversions and treat bigdecimal to double as implicit
(currently it is not as it can be a narrowing/lossy conversion).
Exact numeric issues
--------------------
Key: TEIID-1600
URL:
https://issues.jboss.org/browse/TEIID-1600
Project: Teiid
Issue Type: Bug
Components: Query Engine
Affects Versions: 6.0.0
Reporter: Steven Hawkins
Assignee: Steven Hawkins
Fix For: 8.0
Teiid diverges from the SQL spec by parsing numerical expressions of the form
<integral value>.<integral value> as doubles rather than as an exact numeric
type (which for us would be BigDecimal). I believe this was originally done to match Java
parsing semantics and potentially to avoid performance overhead of using BigBecimal.
However this can lead to a loss of precision that is not expected by ANSI SQL.
inexact numeric values entered in scientific notation would not be affected by this
change. They would still be parsed as doubles.
The SQL spec also requires that the result of AVG on an exact type be returned as an
exact type (although precision and scale are implementation dependent).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira