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

Impala returns NULL when decimal and double values are multiplied in a specific order

    Details

      Description

      For an expression like double_value * decimal_value * double_value and some specific values, impala returns NULL. But for the same value, expression double_value * double_value * decimal_value returns correct result. Please see below example for details:

      [10.17.80.14:21000] > create table dec_test (dbl1 double, dec decimal(9,4), dbl2 double);
      Query: create table dec_test (dbl1 double, dec decimal(9,4), dbl2 double)
      
      Fetched 0 row(s) in 0.18s
      [10.17.80.14:21000] > insert overwrite table dec_test values
                          > (0.0017,90,1.0113),
                          > (0.0342,90,1.0113),
                          > (0.0128,90,1.0113),
                          > (0.0163,90,1.0113);
      Query: insert overwrite table dec_test values
      (0.0017,90,1.0113),
      (0.0342,90,1.0113),
      (0.0128,90,1.0113),
      (0.0163,90,1.0113)
      Inserted 4 row(s) in 0.43s
      [10.17.80.14:21000] > select dbl1 * dec * dbl2 from dec_test;
      Query: select dbl1 * dec * dbl2 from dec_test
      +------------------------------------------+
      | dbl1 * dec * dbl2                        |
      +------------------------------------------+
      | 0.15472890000000002448000000000000000000 |
      | NULL                                     |
      | NULL                                     |
      | NULL                                     |
      +------------------------------------------+
      WARNINGS: UDF WARNING: Expression overflowed, returning NULL
      UDF WARNING: Expression overflowed, returning NULL
      UDF WARNING: Expression overflowed, returning NULL
      
      Fetched 4 row(s) in 0.50s
      [10.17.80.14:21000] > select dbl1 * dbl2 * dec from dec_test;
      Query: select dbl1 * dbl2 * dec from dec_test
      +-------------------------+
      | dbl1 * dbl2 * dec       |
      +-------------------------+
      | 0.154728900000000000000 |
      | 3.112781400000000000000 |
      | 1.165017600000000000000 |
      | 1.483577100000000000000 |
      +-------------------------+
      Fetched 4 row(s) in 0.43s
      [10.17.80.14:21000] >
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lv Lars Volker
                Reporter:
                Yibing Yibing Shi
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: