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.94k stars 5.81k forks source link

ERROR 8118 (HY000): Failed to build executor #27501

Open ChenPeng2013 opened 3 years ago

ChenPeng2013 commented 3 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

use test;
drop table if exists PK_LCP9280;
CREATE TABLE `PK_LCP9280` (
  `COL1` char(1) NOT NULL,
  `COL2` varchar(20) DEFAULT NULL,
  `COL4` datetime DEFAULT NULL,
  `COL3` bigint(20) DEFAULT NULL,
  `COL5` float DEFAULT NULL,
  PRIMARY KEY (`COL1`) /*T![clustered_index] NONCLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
select t1.col1 from PK_LCP9280 as t1 left join PK_LCP9280 as t2 on t1.col1 = t2.col1 where t1.col1 = NULL group by t1.col1 having min(t1.col1) = "憡";

2. What did you expect to see? (Required)

release-4.0 & release-5.0 & release-5.1

mysql> select t1.col1 from PK_LCP9280 as t1 left join PK_LCP9280 as t2 on t1.col1 = t2.col1 where t1.col1 = NULL group by t1.col1 having min(t1.col1) = "憡";
Empty set (0.00 sec)

3. What did you see instead (Required)

release-5.2 & master

mysql> select t1.col1 from PK_LCP9280 as t1 left join PK_LCP9280 as t2 on t1.col1 = t2.col1 where t1.col1 = NULL group by t1.col1 having min(t1.col1) = "憡";
ERROR 8118 (HY000): Failed to build executor

4. What is your TiDB version? (Required)

Release Version: v5.2.0-alpha-706-g79aab25fc
Edition: Community
Git Commit Hash: 79aab25fc21e9a7a87bc2f2eb0859b49742c7716
Git Branch: master
UTC Build Time: 2021-08-23 02:02:16
GoVersion: go1.16.5
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
ichn-hu commented 3 years ago
[executor:8118]Failed to build executor
join's inner condition should be empty
github.com/pingcap/tidb/executor.(*executorBuilder).buildHashJoin
        /home/ichn/Projects/pingcap/tidb/executor/builder.go:1194
github.com/pingcap/tidb/executor.(*executorBuilder).build
        /home/ichn/Projects/pingcap/tidb/executor/builder.go:206
github.com/pingcap/tidb/executor.(*executorBuilder).buildSelection
        /home/ichn/Projects/pingcap/tidb/executor/builder.go:1385
github.com/pingcap/tidb/executor.(*executorBuilder).build
        /home/ichn/Projects/pingcap/tidb/executor/builder.go:216
github.com/pingcap/tidb/executor.(*ExecStmt).buildExecutor
        /home/ichn/Projects/pingcap/tidb/executor/adapter.go:791
github.com/pingcap/tidb/executor.(*ExecStmt).Exec
        /home/ichn/Projects/pingcap/tidb/executor/adapter.go:372
github.com/pingcap/tidb/session.runStmt
        /home/ichn/Projects/pingcap/tidb/session/session.go:1670
github.com/pingcap/tidb/session.(*session).ExecuteStmt
        /home/ichn/Projects/pingcap/tidb/session/session.go:1564
github.com/pingcap/tidb/server.(*TiDBContext).ExecuteStmt
        /home/ichn/Projects/pingcap/tidb/server/driver_tidb.go:219
github.com/pingcap/tidb/server.(*clientConn).handleStmt
        /home/ichn/Projects/pingcap/tidb/server/conn.go:1843
github.com/pingcap/tidb/server.(*clientConn).handleQuery
        /home/ichn/Projects/pingcap/tidb/server/conn.go:1707
github.com/pingcap/tidb/server.(*clientConn).dispatch
        /home/ichn/Projects/pingcap/tidb/server/conn.go:1217
github.com/pingcap/tidb/server.(*clientConn).Run
        /home/ichn/Projects/pingcap/tidb/server/conn.go:979
github.com/pingcap/tidb/server.(*Server).onConn
        /home/ichn/Projects/pingcap/tidb/server/server.go:502
runtime.goexit
        /home/ichn/.gvm/gos/go1.16/src/runtime/asm_amd64.s:1371