query use prefix index and hint IndexHashJoin,occur error: index out of range #24716
Labels
affects-4.0
This bug affects 4.0.x versions.
affects-5.0
This bug affects 5.0.x versions.
severity/major
sig/execution
SIG execution
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
CREATE TABLE
t1
(c_int
int(11) DEFAULT NULL,c_str
varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,PRIMARY KEY (
c_str
(7)) /*T![clustered_index] NONCLUSTERED */);
CREATE TABLE
t2
(c_int
int(11) NOT NULL,c_str
varchar(40) NOT NULL,PRIMARY KEY (
c_int
,c_str
) /*T![clustered_index] NONCLUSTERED */,KEY
c_str
(c_str
(2)));
insert into t1 values(1,'pedantic hellman');
insert into t2 values(11,'objective cohen');
select /*+ INL_HASH_JOIN(t1,t2) */ * from t1 join t2 on t1.c_str = t2.c_str;
2. What did you expect to see? (Required)
query return successful
3. What did you see instead (Required)
query fail:
mysql> select /*+ INL_HASH_JOIN(t1,t2) */ * from t1 join t2 on t1.c_str = t2.c_str;
ERROR 1105 (HY000): runtime error: index out of range [1] with length 1
log:
[2021/05/18 07:27:16.054 +00:00] [ERROR] [misc.go:90] ["panic in the recoverable goroutine"] [r={}] ["stack trace"="github.com/pingcap/tidb/util.WithRecovery.func1\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/util/misc.go:92\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:679\nruntime.goPanicIndex\n\t/usr/local/go/src/runtime/panic.go:75\ngithub.com/pingcap/tidb/executor.(*innerWorker).constructLookupContent\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_join.go:540\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).fetchInnerResults\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:571\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).handleTask\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:600\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).run\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:483\ngithub.com/pingcap/tidb/executor.(IndexNestedLoopHashJoin).startWorkers.func2\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:196\ngithub.com/pingcap/tidb/util.WithRecovery\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/util/misc.go:95"]
[2021/05/18 07:27:16.054 +00:00] [INFO] [conn.go:812] ["command dispatched failed"] [conn=23] [connInfo="id:23, addr:127.0.0.1:51006 status:10, collation:utf8_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="select /+ INL_HASH_JOIN(t1,t2) */ * from t1 join t2 on t1.c_str = t2.c_str"] [txn_mode=PESSIMISTIC] [err="runtime error: index out of range [1] with length 1\ngithub.com/pingcap/tidb/executor.(*IndexNestedLoopHashJoin).finishJoinWorkers\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:203\ngithub.com/pingcap/tidb/util.WithRecovery.func1\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/util/misc.go:87\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:679\nruntime.goPanicIndex\n\t/usr/local/go/src/runtime/panic.go:75\ngithub.com/pingcap/tidb/executor.(*innerWorker).constructLookupContent\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_join.go:540\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).fetchInnerResults\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:571\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).handleTask\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:600\ngithub.com/pingcap/tidb/executor.(*indexHashJoinInnerWorker).run\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:483\ngithub.com/pingcap/tidb/executor.(*IndexNestedLoopHashJoin).startWorkers.func2\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:196\ngithub.com/pingcap/tidb/util.WithRecovery\n\t/home/jenkins/agent/workspace/ld_tidb_multi_branch_release-5.0/go/src/github.com/pingcap/tidb/util/misc.go:95\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1357"]
4. What is your TiDB version? (Required)
Release Version: v5.0.1-3-g41c0f1762
Edition: Community
Git Commit Hash: 41c0f17
Git Branch: release-5.0
UTC Build Time: 2021-05-13 17:21:10
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
The text was updated successfully, but these errors were encountered: