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

Incorrect results on sum(nvl(col,0)) when vectorization is ON

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.1.1
    • None
    • Vectorization
    • None

    Description

      1、

      create table testdb.lc_appl
      (
        loan_no string,
        fee_amt decimal(16,2)
      )
      clustered by (loan_no)
      into 5 buckets
      stored as orc
      tblproperties('transactional'='true');

       

      2、

      insert into testdb.lc_appl
      values ('a',12.12)

      insert into testdb.lc_appl
      values ('b',13.13)

       

      set hive.vectorized.execution.enabled=false;
      select loan_no ,sum(fee_amt),sum(nvl(fee_amt,0))
      from testdb.lc_appl 
      group by loan_no 

      --correct result

      a 12.12 12.12 

      b 13.13 13.13

       

       

      set hive.vectorized.execution.enabled=true;
      select loan_no ,sum(fee_amt),sum(nvl(fee_amt,0))
      from testdb.lc_appl 
      group by loan_no 

      --incorrect result

      a 12.12 0

      b 13.13 0

       

      3、whether hive.vectorized.execution.enabled is true or false, the result below is always right

      select loan_no ,sum(fee_amt),sum(coalesce(fee_amt,0.00))
      from testdb.lc_appl 
      group by loan_no 

      --correct result

      a 12.12 12.12 

      b 13.13 13.13

      Attachments

        Activity

          People

            Unassigned Unassigned
            jhuchuan_run jhuchuan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: