Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 分区表查询排序异常UnionExec chunk column count mismatch

[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:
- part_t is a range partitioned table using a time field
- The data can be queried with the filter conditions that cause the error
- Tried upgrading to v7.1.1, the issue persists
[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]