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

runtime error: index out of range [0] with length 0 #38323

Closed
Reminiscent opened this issue Oct 8, 2022 · 0 comments · Fixed by #40568
Closed

runtime error: index out of range [0] with length 0 #38323

Reminiscent opened this issue Oct 8, 2022 · 0 comments · Fixed by #40568
Assignees
Labels
affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@Reminiscent
Copy link
Contributor

Reminiscent commented Oct 8, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(id int, k int);
prepare stmt from "explain select * from t where id = ? and k = ? group by id, k";

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

No error

3. What did you see instead (Required)

ERROR 1105 (HY000): runtime error: index out of range [0] with length 0

The stack

stack="github.com/pingcap/tidb/server.(*clientConn).Run.func1
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/server/conn.go:1042
runtime.gopanic
	/usr/local/opt/go/libexec/src/runtime/panic.go:890
github.com/pingcap/tidb/executor.(*ExecStmt).Exec.func1
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/executor/adapter.go:437
runtime.gopanic
	/usr/local/opt/go/libexec/src/runtime/panic.go:890
runtime.goPanicIndex
	/usr/local/opt/go/libexec/src/runtime/panic.go:113
github.com/pingcap/tidb/expression.(*ParamMarker).GetUserVar
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/expression/constant.go:91
github.com/pingcap/tidb/expression.(*Constant).getLazyDatum
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/expression/constant.go:187
github.com/pingcap/tidb/expression.(*Constant).Eval
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/expression/constant.go:197
github.com/pingcap/tidb/planner/core.getNameValuePairs
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/planner/core/point_get_plan.go:1314
github.com/pingcap/tidb/planner/core.getNameValuePairs
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/planner/core/point_get_plan.go:1288
github.com/pingcap/tidb/planner/core.tryPointGetPlan
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/planner/core/point_get_plan.go:1002
github.com/pingcap/tidb/planner/core.TryFastPlan
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/planner/core/point_get_plan.go:519
github.com/pingcap/tidb/planner.Optimize
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/planner/optimize.go:154
github.com/pingcap/tidb/planner/core.(*PlanBuilder).buildExplain
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/planner/core/planbuilder.go:4686
github.com/pingcap/tidb/planner/core.(*PlanBuilder).Build
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/planner/core/planbuilder.go:767
github.com/pingcap/tidb/planner/core.GeneratePlanCacheStmtWithAST
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/planner/core/plan_cache_utils.go:135
github.com/pingcap/tidb/executor.(*PrepareExec).Next
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/executor/prepared.go:120
github.com/pingcap/tidb/executor.Next
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/executor/executor.go:324
github.com/pingcap/tidb/executor.(*ExecStmt).next
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/executor/adapter.go:987
github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelayExecutor
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/executor/adapter.go:761
github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelay
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/executor/adapter.go:609
github.com/pingcap/tidb/executor.(*ExecStmt).Exec
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/executor/adapter.go:538
github.com/pingcap/tidb/session.runStmt
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/session/session.go:2213
github.com/pingcap/tidb/session.(*session).ExecuteStmt
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/session/session.go:2077
github.com/pingcap/tidb/server.(*TiDBContext).ExecuteStmt
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/server/driver_tidb.go:231
github.com/pingcap/tidb/server.(*clientConn).handleStmt
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/server/conn.go:2049
github.com/pingcap/tidb/server.(*clientConn).handleQuery
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/server/conn.go:1904
github.com/pingcap/tidb/server.(*clientConn).dispatch
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/server/conn.go:1359
github.com/pingcap/tidb/server.(*clientConn).Run
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/server/conn.go:1104
github.com/pingcap/tidb/server.(*Server).onConn
	/Users/yanchengpeng/go/src/github.com/pingcap/tidb/server/server.go:563"

4. What is your TiDB version? (Required)

latest master

@Reminiscent Reminiscent added type/bug The issue is confirmed as a bug. sig/planner SIG: Planner labels Oct 8, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.0 may-affects-6.1 may-affects-6.2 may-affects-6.3 labels Oct 8, 2022
@ChenPeng2013 ChenPeng2013 added affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 labels Oct 11, 2022
@VelocityLight VelocityLight added the affects-6.5 This bug affects the 6.5.x(LTS) versions. label Dec 2, 2022
@fzzf678 fzzf678 removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. labels Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants