Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-3843

SAP HANA wrong results from MOD with float argument

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • None
    • 8.7.2.6_2
    • Misc. Connectors
    • None

    Description

      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)

      1. get -1*a
      2. compute mod(-1*a,n)
      3. multiply the result by -1
      4. 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.

      Attachments

        Activity

          People

            rhn-engineering-tejones Edwin Jones
            jstastny@redhat.com Jan Stastny
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: