pingcap / pingcap/tidb

planner: coalesce consecutive point scan ranges in physical scans

Open
#67,465 0 comments 0 reactions 0 assignees View on GitHub
sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

`planner: merge OR and IN predicates into IN lists` currently mixes two independent changes:

1. logical predicate simplification (`OR` / `IN` normalization)
2. physical scan range normalization for consecutive point ranges

The second part is implemented by `coalesceConsecutivePointScanRanges` in physical table/index scan building. It changes the physical shape of scan ranges such as:

- `[1,1], [2,2]` -> `[1,2]`
- `[8,8], [9,9]` -> `[8,9]`

This behavior is useful on its own, but it is not part of predicate simplification. Keeping both changes in the same PR makes review scope, regression triage, and cherry-pick decisions harder than necessary.

### Proposal

Split consecutive point range coalescing into an independent planner change that:

- keeps the logical rewrite PR focused on `OR`/`IN` simplification
- keeps physical range normalization reviewable on its own
- updates the affected plan/testdata outputs in one dedicated PR

### Scope

- physical table scan range normalization
- physical index scan range normalization
- related planner / executor testdata updates caused by merged consecutive point ranges

### Non-goals

- changing predicate simplification rules
- changing logical plan rewrites
- broad refactors outside the physical scan range building path

### Notes

The intended behavior is semantically equivalent. The main user-visible changes are in `EXPLAIN` / plan tree outputs and in tests that assert scan ranges directly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.