Partition Table Query Sorting Exception: UnionExec Chunk Column Count Mismatch

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 分区表查询排序异常UnionExec chunk column count mismatch

| username: porpoiselxj

[TiDB Usage Environment] Poc/Test
[TiDB Version]
[Reproduction Path] Upgraded from v6.1.1 to V7.1.0, encountered issues
[Encountered Issues: Symptoms and Impact]
When sorting by a field with a filter condition in a range partitioned table, an error occurs: Error Code 1105 Internal error: UnionExec chunk column count mismatch req: 14, result: 15
Details are as follows:
select * from part_t where id between 1 and 100 - Normal
select * from part_t where id between 1 and 100 order by name - Normal
select * from part_t where id between 1 and 100 order by id - Error

select * from part_t where name between ‘aaaa’ and ‘bbb’ - Normal
select * from part_t where name between ‘aaaa’ and ‘bbb’ order by id - Normal
select * from part_t where name between ‘aaaa’ and ‘bbb’ order by name - Error

PS:

  1. part_t is a range partitioned table using a time field
  2. The data can be queried with the filter conditions that cause the error
  3. Tried upgrading to v7.1.1, the issue persists


[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]

| username: tidb菜鸟一只 | Original post link

There is already a corresponding bug, only in 7.1.*.
UnionExec reports error with static pruning · Issue #45757 · pingcap/tidb · GitHub

| username: porpoiselxj | Original post link

Thank you. After reading the previous posts and verifying, setting tidb_partition_prune_mode=‘dynamic’ can indeed bypass this issue.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.