Runtime Error: index out of range
Bug Report
1. Minimal reproduce step (Required)
create table t0(c0 INT);
create view v1 as select exists( select 6 from t0 union select c_0 from t0 ) c_2 from ( select 0 c_0 ) subq_0;
create view v2 as select 7 c_1 from t0 where ( select c_2 from v1 );
create view v3 as select ( select c_2 from v1 ) c_3, ( select 7 from v2 ) c_4;
select c_4 from v3 where(c_4 = abs(c_3)); ERROR 1105 (HY000) at line 1: runtime error: index out of range [0] with length 0
2. What did you expect to see? (Required)
No error
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
tiup playground nightly --host 0.0.0.0 --kv 3 --tiflash 3
8.0.11-TiDB-v9.0.0-beta.1.pre-554-gb1a5536a64-dirty
/label fuzz/sqlancer
[wait_group_wrapper.go:198] ["panic in the wait group"] [recover="runtime error: index out of range [0] with length 0"] [stack="github.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).RunWithRecover.func1.1\n\t/workspace/source/tidb/pkg/util/wait_group_wrapper.go:198\nruntime.gopanic\n\t/root/go/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:791\nruntime.goPanicIndex\n\t/root/go/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:115\ngithub.com/pingcap/tidb/pkg/util/codec.SerializeKeys.func1\n\t/workspace/source/tidb/pkg/util/codec/codec.go:431\ngithub.com/pingcap/tidb/pkg/util/codec.SerializeKeys\n\t/workspace/source/tidb/pkg/util/codec/codec.go:443\ngithub.com/pingcap/tidb/pkg/executor/join.(*rowTableBuilder).processOneChunk\n\t/workspace/source/tidb/pkg/executor/join/row_table_builder.go:126\ngithub.com/pingcap/tidb/pkg/executor/join.(*BuildWorkerV2).processOneChunk\n\t/workspace/source/tidb/pkg/executor/join/hash_join_v2.go:551\ngithub.com/pingcap/tidb/pkg/executor/join.(*BuildWorkerV2).splitPartitionAndAppendToRowTableImpl\n\t/workspace/source/tidb/pkg/executor/join/hash_join_v2.go:571\ngithub.com/pingcap/tidb/pkg/executor/join.(*BuildWorkerV2).splitPartitionAndAppendToRowTable\n\t/workspace/source/tidb/pkg/executor/join/hash_join_v2.go:533\ngithub.com/pingcap/tidb/pkg/executor/join.(*HashJoinV2Exec).splitAndAppendToRowTable.func1\n\t/workspace/source/tidb/pkg/executor/join/hash_join_v2.go:1446\ngithub.com/pingcap/tidb/pkg/util.(*WaitGroupWrapper).RunWithRecover.func1\n\t/workspace/source/tidb/pkg/util/wait_group_wrapper.go:202"]
It is good in v8.5. but it is bad in the master.
It is caused by https://github.com/pingcap/tidb/pull/55821
It seems to be a problem caused by the optimizer.
The log shows that nullVector in build worker is empty, which causes the panic. In fact, the corresponding column is a nullable column, but the HasNullableKey field in BuildWorkerV2 is initialized with false, which is decided by the passed-in parameter buildTypes which is the return type from the child executor.
@hawkingrei PTAL
🔗 Related Issues
I found some similar issues that might be related, please check them at first, if you think this issue is similar to them, please close this issue.
-
✨ Similar https://github.com/pingcap/tidb/issues/7311 (match via title)
-
✨ Similar https://github.com/pingcap/tidb/issues/12448 (match via title)
-
✨ Similar https://github.com/pingcap/tidb/issues/19226 (match via body)
-
✨ Similar https://github.com/pingcap/tidb/issues/43256 (match via body)
-
✨ Similar https://github.com/pingcap/tidb/issues/22199 (match via body)
This comment was automatically generated based on semantic similarity analysis.