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

Incorrect results in aggregate query grouping by CHAR/VARCHAR

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • Impala 2.0
    • Impala 2.0
    • None
    • None

    Description

      The top two queries have incorrect results. It looks like there is some sort of data corruption. The bottom query using CHAR(5) is fine.

      [localhost.localdomain:21000] > select t1.vc, COUNT(1) FROM chars_tiny t1 GROUP BY 1;
      Query: select t1.vc, COUNT(1) FROM chars_tiny t1 GROUP BY 1
      +------+----------+
      | vc   | count(1) |
      +------+----------+
      | NULL | 1        |
      | 3ccc | 1        |
      |      | 2        |
      |      | 1        |
      |     | 1        |
      |      | 1        |
      |      | 1        |
      |      | 1        |
      +------+----------+
      Fetched 8 row(s) in 0.57s
      
      
      [localhost.localdomain:21000] > select t1.cl, COUNT(1) FROM chars_tiny t1 GROUP BY 1;
      Query: select t1.cl, COUNT(1) FROM chars_tiny t1 GROUP BY 1
      +--------------------------+----------+
      | cl                       | count(1) |
      +--------------------------+----------+
      | @                      | 1        |
      | �`                     |          |
      | ��                     |          |
      | ��                     |          |
      | �                      |          |
      | A��@                 | 1        |
      | �`                     |          |
      | ��                     |          |
      | �                       |          |
      | �@��A��@           | 1        |
      | �`                     |          |
      | �                       |          |
      | �@���@��A��@     | 1        |
      | �                       |          |
      | �@���@���@��A�� | 1        |
      | NULL                     | 1        |
      | �@���@���@��    | 2        |
      | @@���@���@��    | 1        |
      +--------------------------+----------+
      Fetched 8 row(s) in 0.46s
      
      
      [localhost.localdomain:21000] > select t1.cs, COUNT(1) FROM chars_tiny t1 GROUP BY 1;
      Query: select t1.cs, COUNT(1) FROM chars_tiny t1 GROUP BY 1
      +-------+----------+
      | cs    | count(1) |
      +-------+----------+
      | 2aaaa | 1        |
      | 6a    | 2        |
      | 4aa   | 1        |
      | a     | 1        |
      | 1aaaa | 1        |
      | NULL  | 1        |
      | 3aaa  | 1        |
      | 5a    | 1        |
      +-------+----------+
      Fetched 8 row(s) in 0.46s
      

      Postgresql

      functional=# select t1.vc, COUNT(1) FROM chars_tiny t1 GROUP BY 1;
         vc    | count 
      ---------+-------
               |     1
       2cccccc |     1
       4cc     |     1
       5c      |     1
       6c      |     2
       c       |     1
       1cccc   |     1
       3ccc    |     1
      (8 rows)
      
      functional=# select t1.cl, COUNT(1) FROM chars_tiny t1 GROUP BY 1;
                                                                            cl                    
                                                        | count 
      --------------------------------------------------------------------------------------------
      --------------------------------------------------+-------
                                                                                                  
                                                        |     1
       b                                                                                          
                                                        |     1
       2bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
      bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |     1
       4bbbb                                                                                      
                                                        |     1
       1bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
      bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb |     1
       3bbbbb                                                                                     
                                                        |     1
       6b                                                                                         
                                                        |     2
       5bbb                                                                                       
                                                        |     1
      (8 rows)
      
      functional=# select t1.cs, COUNT(1) FROM chars_tiny t1 GROUP BY 1;
        cs   | count 
      -------+-------
       2aaaa |     1
             |     1
       6a    |     2
       a     |     1
       5a    |     1
       1aaaa |     1
       3aaa  |     1
       4aa   |     1
      (8 rows)
      

      Attachments

        Activity

          People

            victor.bittorf_impala_fcb6 Victor Bittorf
            caseyc casey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: