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

    • New Feature
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • None
    • 22.08.1
    • None
    • 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

            denis0x0D Denis Khalikov
            tntnatbry Gagan Goel (Inactive)
            Roman Roman
            Daniel Lee Daniel Lee (Inactive)
            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.