Mryange opened a new pull request, #61232:
URL: https://github.com/apache/doris/pull/61232
### What problem does this PR solve?
## Changes
1. **Remove `ColVecType` from window-path Data types** (`LeadLagData`,
`FirstLastData`, `NthValueData`): The window path enters via virtual
`IAggregateFunction*`, so devirtualizing `insert_from` is pointless. Use
`IColumn::insert_from` virtual call instead. Reader path (CRTP batch loop)
keeps `ColVecType`.
2. **Move `ColVecType` from class-level to function-level** on
`Value`/`CopiedValue`: Only `insert_into` needs it; other members (`reset`,
`is_null`, `set_value`) no longer get 24× instantiated.
3. **Use `void` as marker type**: `FirstLastData` inherits
`ReaderFirstAndLastData<void, ...>`. `if constexpr (std::is_same_v<ColVecType,
void>)` selects virtual vs devirtualized path at compile time.
4. **Lift `arg_ignore_null` to compile-time**: The old runtime `if` inside
the 24-type switch doubled instantiations. Now dispatched at registration via
lambda.
5. **Delete the 300-line type switch**: Replaced by
`CREATE_WINDOW_FUNCTION_DIRECT` macro that directly instantiates 4 combinations
(2×2).
## Compile time (single-thread -j1)
Before
```
[4/7] Compiling: be/src/exprs/aggregate/aggregate_function_window_lag.cpp
→ 60.6s
[6/7] Compiling: be/src/exprs/aggregate/aggregate_function_window_lead.cpp
→ 69.1s
```
Now
```
[1/3] Compiling: be/src/exprs/aggregate/aggregate_function_window_lag.cpp
→ 32.6s
[3/3] Compiling: be/src/exprs/aggregate/aggregate_function_window_lead.cpp
→ 28.8s
```
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]