Tidb: planner: IndexJoin returns ERROR when InnerSide contains filter on virtual column

Created on 17 Feb 2020  Â·  3Comments  Â·  Source: pingcap/tidb

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
mysql> create table t1 (a int, b int);
Query OK, 0 rows affected (0.01 sec)
mysql> create table t2 (a int primary key, b int, c int as ((a+b)) virtual);
Query OK, 0 rows affected (0.02 sec)
mysql> insert into t1 values (1, 1);
Query OK, 1 row affected (0.00 sec)
mysql> desc select /*+ TIDB_INLJ(t2) */ * from t1, t2 where t1.a = t2.a and t2.c > 10;
+--------------------------+-------+-----------+---------------------------------------------------------------------------------+
| id                       | count | task      | operator info                                                                   |
+--------------------------+-------+-----------+---------------------------------------------------------------------------------+
| IndexJoin_10             | 1.25  | root      | inner join, inner:Selection_9, outer key:jointest.t1.a, inner key:jointest.t2.a |
| ├─TableReader_20         | 1.00  | root      | data:Selection_19                                                               |
| │ └─Selection_19         | 1.00  | cop[tikv] | not(isnull(jointest.t1.a))                                                      |
| │   └─TableScan_18       | 1.00  | cop[tikv] | table:t1, range:[-inf,+inf], keep order:false, stats:pseudo                     |
| └─Selection_9            | 1.00  | root      | gt(jointest.t2.c, 10)                                                           |
|   └─TableReader_8        | 1.00  | root      | data:TableScan_7                                                                |
|     └─TableScan_7        | 1.00  | cop[tikv] | table:t2, range: decided by [jointest.t1.a], keep order:false, stats:pseudo     |
+--------------------------+-------+-----------+---------------------------------------------------------------------------------+
7 rows in set (0.00 sec)
mysql> select /*+ TIDB_INLJ(t2) */ * from t1, t2 where t1.a = t2.a and t2.c > 10;
ERROR 1105 (HY000): Wrong plan type for dataReaderBuilder
  1. What did you expect to see?

  2. What did you see instead?

  3. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

mysql> select tidb_version();
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                          |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v4.0.0-beta-156-g713099c-dirty
Git Commit Hash: 713099c1adcb1e65e5e687a1fa88d4b36311c623
Git Branch: master
UTC Build Time: 2020-02-17 08:10:06
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

severitmoderate siplanner statuqualified typbug

All 3 comments

@wjhuang2016 PTAL

verified on
master: v4.0.0-beta.2-743-g45c9d10a

Was this page helpful?
0 / 5 - 0 ratings