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

hidden column don't have to own its virtual expression when its a stored type #52181

Closed
AilinKid opened this issue Mar 28, 2024 · 0 comments · Fixed by #52184
Closed

hidden column don't have to own its virtual expression when its a stored type #52181

AilinKid opened this issue Mar 28, 2024 · 0 comments · Fixed by #52184
Assignees
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.

Comments

@AilinKid
Copy link
Contributor

AilinKid commented Mar 28, 2024

Enhancement

image

here give a strong assertion that hidden column must have a virtual expression

image

while only the non-stored 的 column can have its own virtual expression

Reproduce Steps

change one line of the hiddenColumnTests as below
image
and you got:

Received unexpected error:
        	            	runtime error: invalid memory address or nil pointer dereference
        	            	github.com/pingcap/errors.AddStack
        	            		/Users/arenatlx/go/pkg/mod/github.com/pingcap/[email protected]/errors.go:178
        	            	github.com/pingcap/errors.Trace
        	            		/Users/arenatlx/go/pkg/mod/github.com/pingcap/[email protected]/juju_adaptor.go:15
        	            	github.com/pingcap/tidb/pkg/util.GetRecoverError
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/util/util.go:303
        	            	github.com/pingcap/tidb/pkg/executor/internal/exec.Next.func1
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/executor/internal/exec/executor.go:387
        	            	runtime.gopanic
        	            		/opt/homebrew/opt/go/libexec/src/runtime/panic.go:920
        	            	runtime.panicmem
        	            		/opt/homebrew/opt/go/libexec/src/runtime/panic.go:261
        	            	runtime.sigpanic
        	            		/opt/homebrew/opt/go/libexec/src/runtime/signal_unix.go:861
        	            	github.com/pingcap/tidb/pkg/expression.(*Column).String
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/expression/column.go:395
        	            	github.com/pingcap/tidb/pkg/expression.ExplainExpressionList
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/expression/explain.go:160
        	            	github.com/pingcap/tidb/pkg/planner/core.(*LogicalProjection).ExplainInfo
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/explain.go:916
        	            	github.com/pingcap/tidb/pkg/planner/core.(*baseLogicalPlan).BuildPlanTrace
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/plan.go:856
        	            	github.com/pingcap/tidb/pkg/planner/core.(*logicalOptimizeOp).appendBeforeRuleOptimize
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/optimizer.go:149
        	            	github.com/pingcap/tidb/pkg/planner/core.logicalOptimize
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/optimizer.go:1181
        	            	github.com/pingcap/tidb/pkg/planner/core.doOptimize
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/optimizer.go:321
        	            	github.com/pingcap/tidb/pkg/planner/core.DoOptimize
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/optimizer.go:383
        	            	github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).buildDelete
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/logical_plan_builder.go:6230
        	            	github.com/pingcap/tidb/pkg/planner/core.(*PlanBuilder).Build
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/core/planbuilder.go:507
        	            	github.com/pingcap/tidb/pkg/planner.buildLogicalPlan
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/optimize.go:548
        	            	github.com/pingcap/tidb/pkg/planner.optimize
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/optimize.go:465
        	            	github.com/pingcap/tidb/pkg/planner.Optimize
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/planner/optimize.go:333
        	            	github.com/pingcap/tidb/pkg/executor.(*TraceExec).nextOptimizerPlanTrace
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/executor/trace.go:186
        	            	github.com/pingcap/tidb/pkg/executor.(*TraceExec).Next
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/executor/trace.go:91
        	            	github.com/pingcap/tidb/pkg/executor/internal/exec.Next
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/executor/internal/exec/executor.go:403
        	            	github.com/pingcap/tidb/pkg/executor.(*ExecStmt).next
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/executor/adapter.go:1206
        	            	github.com/pingcap/tidb/pkg/executor.(*recordSet).Next
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/executor/adapter.go:158
        	            	github.com/pingcap/tidb/pkg/session.GetRows4Test
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/session/tidb.go:346
        	            	github.com/pingcap/tidb/pkg/session.ResultSetToStringSlice
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/session/tidb.go:364
        	            	github.com/pingcap/tidb/pkg/testkit.(*TestKit).ResultSetToResultWithCtx
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/testkit/testkit.go:253
        	            	github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustQueryWithContext
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/testkit/testkit.go:179
        	            	github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustQuery
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/testkit/testkit.go:154
        	            	github.com/pingcap/tidb/pkg/table/tables_test.TestHiddenColumn
        	            		/Users/arenatlx/go/src/github.com/pingcap/tidb/pkg/table/tables/tables_test.go:547
        	            	testing.tRunner
        	            		/opt/homebrew/opt/go/libexec/src/testing/testing.go:1595
        	Test:       	TestHiddenColumn
@AilinKid AilinKid added type/enhancement The issue or PR belongs to an enhancement. sig/planner SIG: Planner labels Mar 28, 2024
@AilinKid AilinKid self-assigned this Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant