Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-5022

Decimal Arithmetic generates NULL value

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.11.0
    • Fix Version/s: 0.13.0
    • Component/s: Types
    • Labels:
      None
    • Environment:

      Hortonworks 1.3 running Hive 0.11.0.1.3.0.0-107

      Description

      When a decimal division is the first operation, the quotient cannot be multiplied in a subsequent calculation. Instead, a NULL is returned.

      The following yield NULL results:
      select (cast (4.53 as decimal) / cast(25.86 as decimal)) * cast(0.087 as decimal) from <tablename> limit 1;

      select cast (4.53 as decimal) / cast(25.86 as decimal) * cast(0.087 as decimal) from <tablename> limit 1;

      If we move the multiplication operation to be first, then it will successfully calculate the result.

        Attachments

        1. HIVE-5022.3.patch.txt
          8 kB
          Teddy Choi
        2. HIVE-5022.2.patch.txt
          3 kB
          Teddy Choi
        3. HIVE-5022.1.patch.txt
          1 kB
          Teddy Choi

          Issue Links

            Activity

              People

              • Assignee:
                xuefuz Xuefu Zhang
                Reporter:
                kjsoohoo Kevin Soo Hoo
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: