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

Left outer join returns incorrect results with IS NULL predicates in ON clause.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 1.2.1
    • Impala 1.2.2
    • None

    Description

      Repro:

      create table test_join_a(x integer, y integer);
      create table test_join_b(x integer, y integer);
      insert into test_join_a values(null, 1);
      insert into test_join_a values(null, 2);
      insert into test_join_b values(null, 1);
      insert into test_join_b values(null, 3);
      
      select
          *
      from test_join_a a left join test_join_b b
          on (a.x = b.x or (a.x is null and b.x is null)) and a.y = b.y;
      
      Result of query (incorrect):
      +------+---+------+------+
      | x    | y | x    | y    |
      +------+---+------+------+
      | NULL | 2 | NULL | NULL |
      | NULL | 1 | NULL | NULL |
      +------+---+------+------+
      
      Expected results:
      +------+---+------+------+
      | x    | y | x    | y    |
      +------+---+------+------+
      | NULL | 2 | NULL | NULL |
      | NULL | 1 | NULL | 1    |
      +------+---+------+------+
      
      

      Attachments

        Activity

          People

            nong_impala_60e1 Nong Li
            alex.behm Alexander Behm
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: