Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-6468

Round() is inconsistent for Decimal and Double

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Impala 2.11.0
    • Fix Version/s: Impala 3.0
    • Component/s: Backend
    • Labels:
      None
    • Epic Color:
      ghx-label-3

      Description

      We round away from zero when rounding decimals:

      select round(cast(-5.55 as decimal(10, 5)), 1);
      
      -5.6

       

      However, we round towards positive infinity for doubles.

      select round(cast(-5.55 as double), 1);
      
      -5.5
      
      select round(cast(5.55 as double), 1);
      
      5.6

       

      This seems inconsistent.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: