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

Count(x) may return null when a similar count(distinct x) is also used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 1.3
    • Impala 1.3
    • None
    • None

    Description

      I only tried this on master, 42db599d3485527db80483004ba6a73cb891d0d2

      The first query below has an incorrect result in the first column, the value should be 0. The problem seems somehow related to using the same expression inside a count() and a count(distinct) in the same query.

      [localhost:21000] > select COUNT(1), COUNT(DISTINCT 1) FROM functional.tinytable AS t1 WHERE false;
      Query: select COUNT(1), COUNT(DISTINCT 1) FROM functional.tinytable AS t1 WHERE false
      NULL	0
      Returned 1 row(s) in 0.01s
      
      
      [localhost:21000] > select COUNT(1) FROM functional.tinytable AS t1 WHERE false;
      Query: select COUNT(1) FROM functional.tinytable AS t1 WHERE false
      0
      Returned 1 row(s) in 0.01s
      
      
      [localhost:21000] > select COUNT(DISTINCT 1) FROM functional.tinytable AS t1 WHERE false;
      Query: select COUNT(DISTINCT 1) FROM functional.tinytable AS t1 WHERE false
      0
      Returned 1 row(s) in 0.01s
      

      Attachments

        Activity

          People

            srinathshankar Srinath
            caseyc casey
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: