planner/window: fix TiFlash window pushdown plan regression (extra Projection)
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
This issue is not directly from shiro replay; it is from TiFlash window pushdown regression in planner integration tests.
(For cross-reference, the shiro case used in sibling issues #66106/#66108 is `case_65454` and is unrelated to this TiFlash projection regression.)
Use the setup in `TestAggregationInWindowFunctionPushDownToTiFlash` (`pkg/planner/core/integration_test.go`), then run:
```sql
explain format = 'brief'
select
sum(v) over w as res1,
count(v) over w as res2,
avg(v) over w as res3,
min(v) over w as res4,
max(v) over w as res5
from t
window w as (partition by p order by o);
```
### 2. What did you expect to see? (Required)
No unnecessary extra projection in the TiFlash branch above `TableFullScan`.
### 3. What did you see instead (Required)
An extra `Projection mpp[tiflash] test.t.v, test.t.p, test.t.o` appears and breaks the expected plan output.
### 4. What is your TiDB version? (Required)
## How to test
- `go test -run TestAggregationInWindowFunctionPushDownToTiFlash --tags=intest ./pkg/planner/core -count=1`
- `go test -run TestWindowRangeFramePushDownTiflash --tags=intest ./pkg/planner/core -count=1`
Suggested labels: type/bug, type/regression, component/planner, severity/minor, affects-8.5
Contributor guide
Research direction
Start in pkg/planner/core/integration_test.go with TestAggregationInWindowFunctionPushDownToTiFlash and reproduce the brief EXPLAIN plan. Compare the TiFlash branch with the expected plan and inspect the related window pushdown planner path. Run both named tests, including TestWindowRangeFramePushDownTiflash, and consider the work done when the unnecessary Projection no longer appears and the expected outputs pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100