Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-4715

Mixed inner and outer joins with "null filter" for the table which is not involved into the outer join produces wrong results.

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 22.08.1
    • Component/s: None
    • Labels:
      None

      Description

      create table t1 (a int)engine=columnstore;
      create table t2 (a int)engine=columnstore;
      create table t3 (a int)engine=columnstore;
      insert into t1 values (1), (2), (3);
      insert into t2 values (2), (3);
      insert into t3 values (3);
      

      The following query produces expected result:

      MariaDB [test]> select * from t1 left join t2 left join t3 on t2.a=t3.a on t1.a=t3.a;
      +------+------+------+
      | a    | a    | a    |
      +------+------+------+
      |    1 | NULL | NULL |
      |    2 | NULL | NULL |
      |    3 |    3 |    3 |
      +------+------+------+
      

      However, if we apply an 'is null' WHERE predicate to the above query, we get incorrect result:

      MariaDB [test]> select * from t1 left join t2 left join t3 on t2.a=t3.a on t1.a=t3.a where t2.a is null;
      +------+------+------+
      | a    | a    | a    |
      +------+------+------+
      |    1 | NULL | NULL |
      |    2 | NULL | NULL |
      |    3 | NULL | NULL |
      +------+------+------+
      

      The expected result is the below (here, i1, i2, i3 are equivalent InnoDB tables):

      MariaDB [test]> select * from i1 left join i2 left join i3 on i2.a=i3.a on i1.a=i3.a where i2.a is null;
      +------+------+------+
      | a    | a    | a    |
      +------+------+------+
      |    1 | NULL | NULL |
      |    2 | NULL | NULL |
      +------+------+------+
      

        Attachments

          Activity

            People

            Assignee:
            denis0x0D Denis Khalikov
            Reporter:
            tntnatbry Gagan Goel
            Assigned for Review:
            Roman Roman
            Assigned for Testing:
            Daniel Lee Daniel Lee
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.