Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Impala 2.0
    • Fix Version/s: Impala 2.11.0
    • Component/s: Frontend
    • Labels:
      None

      Description

      For decimal_v2=true, we should revisit the add/sub result type. Currently, we set result scale to max(S1, S2) (potentially losing precision). Other systems (e.g. SQL Server) seem to choose either S1 or S2 depending on whether digits to the left of the decimal point would be lost. This would require changes to the backend implementation of add/sub, however.

      Currently we compute rP and rS as follows:

      rS = max(s1, s2)
      rP = max(s1, s2) + max(p1 - s1, p2 - s2) + 1
      

      We currently handle the case where rP > 38 as follows:

      if (rP > 38):
        rP = 38
        rS = min(38, rS)
      

      This basically truncates the digits to the left of the decimal point.

      The proposed result under V2 is:

      if (rP > 38):
        minS = min(rS, 6)
        rS = rS - (rP - 38)
        rS = max(minS, rS)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tarasbob Taras Bobrovytsky
                Reporter:
                dhecht Dan Hecht
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: