Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-3688

LP:887026 - Wrong result with ICP, outer join, subquery in maria-5.3-icp

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      The following query:

      SELECT *
      FROM t1
      LEFT JOIN t2
      ON 1
      WHERE ( t2.b ) NOT IN (
              SELECT t4.b
              FROM t3, t4
              WHERE t4.b <= 2
              AND t4.c = t3.c
      );

      returns no rows when executed with maria-5.3-icp and index_condition_pushdown=ON and

      {c,NULL}

      in all other cases. The issue is also reproducible without empty/constant tables. The issue is also reproducible with realistic ON conditions.

      explain:

      id select_type table type possible_keys key key_len ref rows Extra
      1 PRIMARY t1 ALL NULL NULL NULL NULL 1
      1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where
      2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 1
      2 DEPENDENT SUBQUERY t4 ref_or_null b b 5 func 2 Using index condition; Using where; Full scan on NULL key

      minimal switch: index_condition_pushdown=ON;
      full switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on

       bzr version-info
      revision-id: <email address hidden>
      date: 2011-11-06 01:23:03 -0700
      build-date: 2011-11-07 10:39:33 +0200
      revno: 3269
      branch-nick: maria-5.3-icp

      test case:

      CREATE TABLE t1 ( c varchar(1)) ENGINE=InnoDB;
      INSERT INTO t1 VALUES ('c');

      CREATE TABLE t2 ( b int) ENGINE=InnoDB;

      CREATE TABLE t3 ( c varchar(1)) ENGINE=InnoDB;
      INSERT INTO t3 VALUES ('c');

      CREATE TABLE t4 ( b int, c varchar(1), KEY (b)) ENGINE=InnoDB;
      INSERT INTO t4 VALUES (7,'c');

      SET SESSION optimizer_switch='index_condition_pushdown=ON';
      SELECT *
      FROM t1
      LEFT JOIN t2
      ON 1
      WHERE ( t2.b ) NOT IN (
              SELECT t4.b
              FROM t3, t4
              WHERE t4.b <= 2
              AND t4.c = t3.c
      );

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            philipstoev Philip Stoev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 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.