Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index join returns error when join key is enum/set #19233

Closed
SunRunAway opened this issue Aug 17, 2020 · 0 comments · Fixed by #19235
Closed

Index join returns error when join key is enum/set #19233

SunRunAway opened this issue Aug 17, 2020 · 0 comments · Fixed by #19235
Labels
component/executor severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@SunRunAway
Copy link
Contributor

SunRunAway commented Aug 17, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists i;
drop table if exists p;
drop table if exists t;
CREATE TABLE `p` (
    `type` enum('HOST_PORT') NOT NULL,
    UNIQUE KEY (`type`)
) ;

CREATE TABLE `i` (
  `objectType` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

insert into i values ('SWITCH');

create table t like i;
insert into t values ('HOST_PORT');
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;

insert into i select * from t;

insert into p values('HOST_PORT');
select /*+ INL_HASH_JOIN(p) */ * from i, p where i.objectType = p.type;

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

select /*+ INL_HASH_JOIN(p) */ * from i, p where i.objectType = p.type;
...
65536 rows in set (0.05 sec)

3. What did you see instead (Required)

select /*+ INL_HASH_JOIN(p) */ * from i, p where i.objectType = p.type;
ERROR 1265 (01000): Data truncated for column '%s' at row %d

And panic occurs in the log

[2020/08/17 15:47:32.075 +08:00] [ERROR] [misc.go:91] ["panic in the recoverable goroutine"] [r="\"invalid memory address or nil pointer dereference\""] ["stack trace"="github.com/pingcap/tidb/util.WithRecovery.func1\n\t/Users/sunrunaway/Code/gopath/src/github.com/pingcap/tidb/util/misc.go:93\nruntime.gopanic\n\t/usr/local/Cellar/[email protected]/1.13.9/libexec/src/runtime/panic.go:679\nruntime.panicmem\n\t/usr/local/Cellar/[email protected]/1.13.9/libexec/src/runtime/panic.go:199\nruntime.sigpanic\n\t/usr/local/Cellar/[email protected]/1.13.9/libexec/src/runtime/signal_unix.go:394\ngithub.jparrowsec.cn/pingcap/tidb/util/chunk.(*iterator4List).Begin\n\t/Users/sunrunaway/Code/gopath/src/github.com/pingcap/tidb/util/chunk/iterator.go:190\ngithub.jparrowsec.cn/pingcap/tidb/util/chunk.(*iterator4List).Begin\n\t/Users/sunrunaway/Code/gopath/src/github.com/pingcap/tidb/util/chunk/iterator.go:190\ngithub.jparrowsec.cn/pingcap/tidb/executor.(*indexHashJoinInnerWorker).doJoinUnordered\n\t/Users/sunrunaway/Code/gopath/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:575\ngithub.jparrowsec.cn/pingcap/tidb/executor.(*indexHashJoinInnerWorker).handleTask\n\t/Users/sunrunaway/Code/gopath/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:567\ngithub.jparrowsec.cn/pingcap/tidb/executor.(*indexHashJoinInnerWorker).run\n\t/Users/sunrunaway/Code/gopath/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:459\ngithub.jparrowsec.cn/pingcap/tidb/executor.(*IndexNestedLoopHashJoin).startWorkers.func2\n\t/Users/sunrunaway/Code/gopath/src/github.com/pingcap/tidb/executor/index_lookup_hash_join.go:185\ngithub.jparrowsec.cn/pingcap/tidb/util.WithRecovery\n\t/Users/sunrunaway/Code/gopath/src/github.com/pingcap/tidb/util/misc.go:96"]

4. What is your TiDB version? (Required)

v4.0.4, master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/executor severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants