pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.93k stars 5.81k forks source link

show `CARTESIAN JOIN` inappropriately in some cases #20261

Open qw4990 opened 3 years ago

qw4990 commented 3 years ago

Development Task

mysql> desc select /*+ tidb_hj(t1) */ * from t t1 inner join t t2 where t1.a=t2.a and t1.a=1;
+---------------------------+---------+------+---------------+----------------------+
| id                        | estRows | task | access object | operator info        |
+---------------------------+---------+------+---------------+----------------------+
| HashJoin_7                | 1.00    | root |               | CARTESIAN inner join |
| ├─Point_Get_10(Build)     | 1.00    | root | table:t       | handle:1             |
| └─Point_Get_9(Probe)      | 1.00    | root | table:t       | handle:1             |
+---------------------------+---------+------+---------------+----------------------+
3 rows in set (0.00 sec)

In the case above, it's not a cartesian join, but there is a CARTESIAN in the result.

3AceShowHand commented 3 years ago

/assign