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

Panic triggered at expression.(*CorrelatedColumn).Eval (expression/column.go:88) #42739

Closed
JZuming opened this issue Apr 2, 2023 · 2 comments · Fixed by #42789
Closed

Panic triggered at expression.(*CorrelatedColumn).Eval (expression/column.go:88) #42739

JZuming opened this issue Apr 2, 2023 · 2 comments · Fixed by #42789
Assignees
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 affects-7.5 report/customer Customers have encountered this bug. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@JZuming
Copy link

JZuming commented Apr 2, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Setup the database:

CREATE TABLE t0 (c1 double, c2 double);

Testcase

select
  exists (
    select
          subq_2.c0 as c8
        from
          (select
                ref_153.c1 as c0
              from
                t0 as ref_153
              group by ref_153.c1 having 0 <> (
                  select 1
                    from
                      t0 as ref_173
                    where count(ref_153.c2) = avg(ref_153.c2)
                    order by c1 desc limit 1)) as subq_2
     ) as c10;

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

No panic.

3. What did you see instead (Required)

ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference

TiDB log:

[ERROR] [conn.go:1039] ["connection running loop panic"] [conn=2199023352193] [lastSQL="select  
  exists (
    select  
          subq_2.c0 as c8
        from 
          (select  
                ref_153.c1 as c0 
              from 
                t0 as ref_153
              group by ref_153.c1 having 0 <> ( 
                  select 1 
                    from 
                      t0 as ref_173
                    where count(ref_153.c2) = avg(ref_153.c2)
                    order by c1 desc limit 1)) as subq_2
     ) as c10"] [err="runtime error: invalid memory address or nil pointer dereference"] [stack="github.com/pingcap/tidb/server.(*clientConn).Run.func1
    /root/tidb/server/conn.go:1042
runtime.gopanic
    /usr/local/go/src/runtime/panic.go:884
github.com/pingcap/tidb/executor.(*Compiler).Compile.func1
    /root/tidb/executor/compiler.go:54
runtime.gopanic
    /usr/local/go/src/runtime/panic.go:884
runtime.panicmem
    /usr/local/go/src/runtime/panic.go:260
runtime.sigpanic
    /usr/local/go/src/runtime/signal_unix.go:837
github.com/pingcap/tidb/expression.(*CorrelatedColumn).Eval
    /root/tidb/expression/column.go:88
github.com/pingcap/tidb/expression.PbConverter.conOrCorColToPBExpr
    /root/tidb/expression/expr_to_pb.go:81
github.com/pingcap/tidb/expression.canExprPushDown
    /root/tidb/expression/expression.go:1422
github.com/pingcap/tidb/expression.canScalarFuncPushDown
    /root/tidb/expression/expression.go:1378
github.com/pingcap/tidb/expression.canExprPushDown
    /root/tidb/expression/expression.go:1428
github.com/pingcap/tidb/expression.canScalarFuncPushDown
    /root/tidb/expression/expression.go:1378
github.com/pingcap/tidb/expression.canExprPushDown
    /root/tidb/expression/expression.go:1428
github.com/pingcap/tidb/expression.PushDownExprsWithExtraInfo
    /root/tidb/expression/expression.go:1437
github.com/pingcap/tidb/expression.PushDownExprs
    /root/tidb/expression/expression.go:1448
github.com/pingcap/tidb/planner/core.(*DataSource).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:141
github.com/pingcap/tidb/planner/core.(*LogicalSelection).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:108
github.com/pingcap/tidb/planner/core.(*baseLogicalPlan).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:81
github.com/pingcap/tidb/planner/core.(*LogicalProjection).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:479
github.com/pingcap/tidb/planner/core.(*baseLogicalPlan).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:81
github.com/pingcap/tidb/planner/core.(*baseLogicalPlan).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:81
github.com/pingcap/tidb/planner/core.(*LogicalLimit).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:607
github.com/pingcap/tidb/planner/core.(*baseLogicalPlan).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:81
github.com/pingcap/tidb/planner/core.(*LogicalMaxOneRow).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:614
github.com/pingcap/tidb/planner/core.(*LogicalJoin).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:239
github.com/pingcap/tidb/planner/core.(*LogicalSelection).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:108
github.com/pingcap/tidb/planner/core.(*LogicalJoin).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:239
github.com/pingcap/tidb/planner/core.(*baseLogicalPlan).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:81
github.com/pingcap/tidb/planner/core.(*LogicalProjection).PredicatePushDown
    /root/tidb/planner/core/rule_predicate_push_down.go:479
github.com/pingcap/tidb/planner/core.(*ppdSolver).optimize
    /root/tidb/planner/core/rule_predicate_push_down.go:46
github.com/pingcap/tidb/planner/core.logicalOptimize
    /root/tidb/planner/core/optimizer.go:1093
github.com/pingcap/tidb/planner/core.DoOptimize
    /root/tidb/planner/core/optimizer.go:294
github.com/pingcap/tidb/planner.optimize
    /root/tidb/planner/optimize.go:467
github.com/pingcap/tidb/planner.Optimize
    /root/tidb/planner/optimize.go:295
github.com/pingcap/tidb/executor.(*Compiler).Compile
    /root/tidb/executor/compiler.go:98
github.com/pingcap/tidb/session.(*session).ExecuteStmt
    /root/tidb/session/session.go:2139
github.com/pingcap/tidb/server.(*TiDBContext).ExecuteStmt
    /root/tidb/server/driver_tidb.go:252
github.com/pingcap/tidb/server.(*clientConn).handleStmt
    /root/tidb/server/conn.go:2054
github.com/pingcap/tidb/server.(*clientConn).handleQuery
    /root/tidb/server/conn.go:1851
github.com/pingcap/tidb/server.(*clientConn).dispatch
    /root/tidb/server/conn.go:1337
github.com/pingcap/tidb/server.(*clientConn).Run
    /root/tidb/server/conn.go:1120
github.com/pingcap/tidb/server.(*Server).onConn
    /root/tidb/server/server.go:675"]

4. What is your TiDB version? (Required)

+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v7.1.0-alpha-27-gf5ca27ef3
Edition: Community
Git Commit Hash: f5ca27e
Git Branch: master
UTC Build Time: 2023-03-23 13:57:53
GoVersion: go1.20.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: unistore |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

@JZuming JZuming added the type/bug The issue is confirmed as a bug. label Apr 2, 2023
@JZuming JZuming changed the title Panic triggered at expression.(*CorrelatedColumn).Eval (column.go:88) Panic triggered at expression.(*CorrelatedColumn).Eval (expression/column.go:88) Apr 2, 2023
@jebter jebter added sig/execution SIG execution severity/major affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.6 labels Apr 3, 2023
@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-6.5 labels Apr 3, 2023
@zanmato1984
Copy link
Contributor

Changing sig to sql-infra.

@zanmato1984 zanmato1984 added sig/sql-infra SIG: SQL Infra and removed sig/execution SIG execution labels Apr 23, 2023
@CbcWestwolf CbcWestwolf added affects-6.5 and 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.0 This bug maybe affects 5.0.x versions. may-affects-6.5 affects-6.6 labels Nov 26, 2023
@seiya-annie
Copy link

/report customer

@ti-chi-bot ti-chi-bot bot added the report/customer Customers have encountered this bug. label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 affects-7.5 report/customer Customers have encountered this bug. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants