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

ERROR 1105 (HY000): interface conversion #46556

Closed
bajinsheng opened this issue Aug 31, 2023 · 2 comments · Fixed by #52989
Closed

ERROR 1105 (HY000): interface conversion #46556

bajinsheng opened this issue Aug 31, 2023 · 2 comments · Fixed by #52989

Comments

@bajinsheng
Copy link

Bug Report

1. Minimal reproduce step (Required)

CREATE TABLE t0(c0 BLOB);
CREATE VIEW v0(c0) AS SELECT NULL FROM t0 GROUP BY NULL;
SELECT t0.c0 FROM t0 NATURAL JOIN v0 WHERE v0.c0 LIKE v0.c0; -- ERROR 1105 (HY000): interface conversion: expression.Expression is *expression.ScalarFunction, not *expression.Column

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

3. What did you see instead (Required)

Unexpected error

4. What is your TiDB version? (Required)

| Release Version: v7.4.0-alpha-239-g4f2f5e1061
Edition: Community
Git Commit Hash: 4f2f5e1
Git Branch: master
UTC Build Time: 2023-08-30 12:06:00
GoVersion: go1.21.0
Race Enabled: false
Check Table Before Drop: false
Store: unistore |

@bajinsheng bajinsheng added the type/bug The issue is confirmed as a bug. label Aug 31, 2023
@bajinsheng
Copy link
Author

/label fuzz/sqlancer

@guo-shaoge
Copy link
Collaborator

guo-shaoge commented Jan 15, 2024

Looks like planner assume join key expr is column here, but actually it's a cast expression.

Error stack:

[2024/01/15 14:01:23.169 +08:00] [ERROR] [conn.go:1021] ["connection running loop panic"] [conn=1570766854] [session_alias=] [lastSQL="SELECT t0.c0 FROM t0 NATURAL JOIN v0 WHERE v0.c0 LIKE v0.c0"] [err="interface conversion:            expression.Expression is *expression.ScalarFunction, not *expression.Column"] [stack="github.com/pingcap/tidb/pkg/server.(*clientConn).Run.func1
      /home/guojiangtao/work/tidb/pkg/server/conn.go:1024
  runtime.gopanic
      /usr/local/go/src/runtime/panic.go:920
  github.com/pingcap/tidb/pkg/executor.(*Compiler).Compile.func1
      /home/guojiangtao/work/tidb/pkg/executor/compiler.go:56
  runtime.gopanic
      /usr/local/go/src/runtime/panic.go:920
  runtime.panicdottypeE
      /usr/local/go/src/runtime/iface.go:263
  runtime.panicdottypeI
      /usr/local/go/src/runtime/iface.go:273
  github.com/pingcap/tidb/pkg/planner/core.(*LogicalJoin).GetJoinKeys
      /home/guojiangtao/work/tidb/pkg/planner/core/logical_plans.go:356
  github.com/pingcap/tidb/pkg/planner/core.(*LogicalJoin).ExtractColGroups
      /home/guojiangtao/work/tidb/pkg/planner/core/stats.go:854
  github.com/pingcap/tidb/pkg/planner/core.(*baseLogicalPlan).recursiveDeriveStats
      /home/guojiangtao/work/tidb/pkg/planner/core/stats.go:130
  github.com/pingcap/tidb/pkg/planner/core.(*joinReorderGreedySolver).constructConnectedJoinTree
      /home/guojiangtao/work/tidb/pkg/planner/core/rule_join_reorder_greedy.go:106
  github.com/pingcap/tidb/pkg/planner/core.(*joinReorderGreedySolver).solve
      /home/guojiangtao/work/tidb/pkg/planner/core/rule_join_reorder_greedy.go:74
  github.com/pingcap/tidb/pkg/planner/core.(*joinReOrderSolver).optimizeRecursive
      /home/guojiangtao/work/tidb/pkg/planner/core/rule_join_reorder.go:294
  github.com/pingcap/tidb/pkg/planner/core.(*joinReOrderSolver).optimizeRecursive
      /home/guojiangtao/work/tidb/pkg/planner/core/rule_join_reorder.go:332
  github.com/pingcap/tidb/pkg/planner/core.(*joinReOrderSolver).optimize
      /home/guojiangtao/work/tidb/pkg/planner/core/rule_join_reorder.go:230
  github.com/pingcap/tidb/pkg/planner/core.logicalOptimize
      /home/guojiangtao/work/tidb/pkg/planner/core/optimizer.go:1166
  github.com/pingcap/tidb/pkg/planner/core.doOptimize
      /home/guojiangtao/work/tidb/pkg/planner/core/optimizer.go:328
  github.com/pingcap/tidb/pkg/planner/core.DoOptimize
      /home/guojiangtao/work/tidb/pkg/planner/core/optimizer.go:370
  github.com/pingcap/tidb/pkg/planner.optimize
      /home/guojiangtao/work/tidb/pkg/planner/optimize.go:504
  github.com/pingcap/tidb/pkg/planner.Optimize
      /home/guojiangtao/work/tidb/pkg/planner/optimize.go:335
  github.com/pingcap/tidb/pkg/executor.(*Compiler).Compile
      /home/guojiangtao/work/tidb/pkg/executor/compiler.go:104
  github.com/pingcap/tidb/pkg/session.(*session).ExecuteStmt
      /home/guojiangtao/work/tidb/pkg/session/session.go:2185
  github.com/pingcap/tidb/pkg/server.(*TiDBContext).ExecuteStmt
      /home/guojiangtao/work/tidb/pkg/server/driver_tidb.go:294
  github.com/pingcap/tidb/pkg/server.(*clientConn).handleStmt
      /home/guojiangtao/work/tidb/pkg/server/conn.go:2024
  github.com/pingcap/tidb/pkg/server.(*clientConn).handleQuery
      /home/guojiangtao/work/tidb/pkg/server/conn.go:1775
  github.com/pingcap/tidb/pkg/server.(*clientConn).dispatch
      /home/guojiangtao/work/tidb/pkg/server/conn.go:1349
  github.com/pingcap/tidb/pkg/server.(*clientConn).Run
      /home/guojiangtao/work/tidb/pkg/server/conn.go:1122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants