]
RH Bugzilla Integration commented on TEIID-3843:
------------------------------------------------
Van Halbert <vhalbert(a)redhat.com> changed the Status of [bug
SAP HANA wrong results from MOD with float argument
---------------------------------------------------
Key: TEIID-3843
URL:
https://issues.jboss.org/browse/TEIID-3843
Project: Teiid
Issue Type: Bug
Components: Misc. Connectors
Affects Versions: 8.7.2.6_2
Reporter: Jan Stastny
Assignee: Ted Jones
SAP HANA doesn't handle correctly MOD function with float arguments. The problem
occurs when the float value is less than zero.
According to SAP HANA documentation, its MOD implementation follows the symmetric
handling of MOD on less than zero values. In such case, the resulting value should be
computed as:
a is negative whole number
n is positive whole number
mod(a,n)
# get -1*a
# compute mod(-1*a,n)
# multiply the result by -1
# result is -1*mod(-1*a,n)
SAP HANA follows this rule for other numeric types than float. For example for Long value
-24 MOD(-24,11)=-2 , which is correct according to the MOD definition.
But when you call MOD(-24.0,11) you get 2.0
In current state, the only thing Teiid could do is to prevent pushing MOD with float
arguments. It helps to cast explicitly the column to double.