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

UnionExec reports error with static pruning #45757

Closed
aytrack opened this issue Aug 2, 2023 · 2 comments
Closed

UnionExec reports error with static pruning #45757

aytrack opened this issue Aug 2, 2023 · 2 comments
Assignees
Labels
affects-7.1 component/tablepartition This issue is related to Table Partition of TiDB. report/community The community has encountered this bug. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@aytrack
Copy link
Contributor

aytrack commented Aug 2, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t;
create table t(id bigint, datecode bigint, c int, index idx(id, datecode)) partition by range(datecode) (partition p0 values less than (20230501), partition p1 values less than (20230601), partition p2 values less than (20230701));
insert into t values (111111111111111, 20230403, 0), (111111111111111, 20230503, 1), (111111111111111, 20230603, 2);
set tidb_partition_prune_mode='static';
select * from t use index (idx) where id = 111111111111111 and datecode between 20230420 and 20230620 order by datecode limit 2;

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

query success

3. What did you see instead (Required)

[16:11:33]TiDB root:test> select * from t use index (idx) where id = 111111111111111 and datecode between 20230420 and 20230620 order by datecode limit 2;
(1105, 'Internal error: UnionExec chunk column count mismatch, req: 3, result: 4')
[2023/08/02 16:11:33.528 +08:00] [INFO] [conn.go:1184] ["command dispatched failed"] [conn=2254102191033811351] [connInfo="id:2254102191033811351, addr:127.0.0.1:58937 status:10, collation:utf8_general_ci, user:root"] [command=Query] [status="inTxn:0, autocommit:1"] [sql="select * from t use index (idx) where id = 111111111111111 and datecode between 20230420 and 20230620 order by datecode limit 2"] [txn_mode=PESSIMISTIC] [timestamp=443276038895304705] [err="Internal error: UnionExec chunk column count mismatch, req: 3, result: 4
github.com/pingcap/tidb/executor.(*UnionExec).Next
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:2007
github.com/pingcap/tidb/executor.Next
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:326
github.com/pingcap/tidb/executor.(*TopNExec).loadChunksUntilTotalLimit
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/sort.go:440
github.com/pingcap/tidb/executor.(*TopNExec).Next
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/sort.go:406
github.com/pingcap/tidb/executor.Next
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/executor.go:326
github.com/pingcap/tidb/executor.(*ExecStmt).next
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:1202
github.com/pingcap/tidb/executor.(*recordSet).Next
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/executor/adapter.go:151
github.com/pingcap/tidb/server.(*tidbResultSet).Next
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/driver_tidb.go:469
github.com/pingcap/tidb/server.(*clientConn).writeChunks
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2313
github.com/pingcap/tidb/server.(*clientConn).writeResultSet
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2256
github.com/pingcap/tidb/server.(*clientConn).handleStmt
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:2124
github.com/pingcap/tidb/server.(*clientConn).handleQuery
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1885
github.com/pingcap/tidb/server.(*clientConn).dispatch
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1372
github.com/pingcap/tidb/server.(*clientConn).Run
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/conn.go:1153
github.com/pingcap/tidb/server.(*Server).onConn
	/Users/pingcap/workspace/build-common/go/src/github.com/pingcap/tidb/server/server.go:677
runtime.goexit
	/usr/local/go1.20.5/src/runtime/asm_arm64.s:1172"]

4. What is your TiDB version? (Required)

v7.1.1

@aytrack aytrack added type/bug The issue is confirmed as a bug. sig/sql-infra SIG: SQL Infra severity/major component/tablepartition This issue is related to Table Partition of TiDB. affects-7.1 labels Aug 2, 2023
@ti-chi-bot ti-chi-bot bot added 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.1 may-affects-6.5 labels Aug 2, 2023
@Defined2014 Defined2014 removed 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.1 may-affects-6.5 labels Aug 2, 2023
@Defined2014
Copy link
Contributor

Only affects v7.1.x

@seiya-annie
Copy link

/found community

@ti-chi-bot ti-chi-bot bot added the report/community The community has encountered this bug. label Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.1 component/tablepartition This issue is related to Table Partition of TiDB. report/community The community has encountered this bug. severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

4 participants