Closed superlzs0476 closed 2 years ago
how to fit it?
Seems it is fixed in master and release-6.2 branch, I can reproduce it with v6.1.0, but failed to reproduce it in master and v6.2.0
Also it should be a planner bug instead of runtime bug.
OK, we will take it. Can you kindly shed some light on how you found out it is planner bug? @windtalker
the sql can execute after set tidb_enable_outer_join_reorder=OFF
MySQL root@127.0.0.1:test> select d.tid,smi.tid ,b.tid ,
-> SUM(CASE WHEN d.period < '2020-01' THEN d.pay ELSE 0 END) AS beforeYearAmt
-> FROM testdbs.m_info smi
-> INNER JOIN testdbs.b2_info d
-> ON smi.code = d.code1 AND d.type1 = '03' AND smi.code3 = 'S21011'
-> LEFT JOIN testdbs.h_info a ON smi.code4 = a.code AND smi.type3 = '01'
-> LEFT JOIN testdbs.b1_info b ON a.btestcode = b.code
-> WHERE d.code2 = 'S21011'
-> AND d.period <= '2021-12'
-> LIMIT 10
(8118, 'Failed to build executor')
MySQL root@127.0.0.1:test> set tidb_enable_outer_join_reorder=OFF;
Query OK, 0 rows affected
Time: 0.001s
MySQL root@127.0.0.1:test> select d.tid,smi.tid ,b.tid ,
-> SUM(CASE WHEN d.period < '2020-01' THEN d.pay ELSE 0 END) AS beforeYearAmt
-> FROM testdbs.m_info smi
-> INNER JOIN testdbs.b2_info d
-> ON smi.code = d.code1 AND d.type1 = '03' AND smi.code3 = 'S21011'
-> LEFT JOIN testdbs.h_info a ON smi.code4 = a.code AND smi.type3 = '01'
-> LEFT JOIN testdbs.b1_info b ON a.btestcode = b.code
-> WHERE d.code2 = 'S21011'
-> AND d.period <= '2021-12'
-> LIMIT 10
+--------+--------+--------+---------------+
| tid | tid | tid | beforeYearAmt |
+--------+--------+--------+---------------+
| <null> | <null> | <null> | <null> |
+--------+--------+--------+---------------+
Can't reproduce this issue on master and v6.1.1. Closing this issue.
The default value of tidb_enable_outer_join_reorder
on v6.1.0 is true. From v6.1.1 and v6.2.0 the default is set to false.
we already turned it on, still can't reproduce. The outer join bug has been fixed.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Step 1. Default TiUP Playground v6.1.0 Step 2. create tables and database
Step 3 Executor SQL
2. What did you expect to see? (Required)
Select Query is executor success.
3. What did you see instead (Required)
Executor error log on the terminal client "Error [8118] [HY000]: Failed to build executor "
4. What is your TiDB version? (Required)
v6.1.0