Mryange opened a new pull request, #61606:
URL: https://github.com/apache/doris/pull/61606
### What problem does this PR solve?
Optimize the compilation time of `aggregate_function_orthogonal_bitmap.cpp`
by reducing template instantiation bloat and improving build parallelism.
### Changes
**1. Split single translation unit into multiple files**
The original `aggregate_function_orthogonal_bitmap.cpp` instantiated all 6
aggregate functions (~36 template instances) in a single file, forcing serial
compilation. Now split into:
- `aggregate_function_orthogonal_bitmap.cpp` — forward declarations +
registration only (compiles fast)
- `aggregate_function_orth_bitmap_intersect.cpp`
- `aggregate_function_orth_bitmap_intersect_count.cpp`
- `aggregate_function_orth_bitmap_union_count.cpp`
- `aggregate_function_orth_intersect_count.cpp`
- `aggregate_function_orth_bitmap_expr_cal.cpp`
- `aggregate_function_orth_bitmap_expr_cal_count.cpp`
**2. Remove unnecessary `PrimitiveType` template parameter from
`OrthBitmapUnionCountData`**
`OrthBitmapUnionCountData<T>` never uses `T` — it only operates on
`ColumnBitmap` directly. Removed the template parameter, reducing 6 useless
instantiations to 1.
**3. Eliminate type dispatch for `ExprCal` / `ExprCalCount`**
FE guarantees these functions receive exactly 3 parameters with VARCHAR
filter columns. Replaced the generic 6-type dispatch with direct `TYPE_STRING`
instantiation, reducing 12 instantiations to 2.
**4. Use precise expression tags matching FE definitions**
Added `ExprTag` template parameter to `AggFunctionOrthBitmapFunc` (default:
`VarargsExpression`):
| Function | FE Arity | Old BE Tag | New BE Tag |
|----------|----------|------------|------------|
| `orthogonal_bitmap_union_count` | `UnaryExpression` (1 arg) |
`VarargsExpression` | `UnaryExpression` |
| `orthogonal_bitmap_expr_calculate` | Fixed 3 args | `VarargsExpression` |
`MultiExpression` |
| `orthogonal_bitmap_expr_calculate_count` | Fixed 3 args |
`VarargsExpression` | `MultiExpression` |
| Others (intersect/intersect_count) | Varargs (≥3) | `VarargsExpression` |
`VarargsExpression` (unchanged) |
**5. Add `inline` to template specializations in `bitmap_intersect.h`**
The `Helper::write_to` / `serialize_size` / `read_from` template
specializations in the header lacked `inline`, causing duplicate symbol linker
errors after splitting into multiple translation units.
### Summary
| Metric | Before | After |
|--------|--------|-------|
| Translation units | 1 (serial) | 7 (parallel) |
| Template instantiations | ~36 | ~21 (~42% reduction) |
| `ExprCal`/`ExprCalCount` instantiations | 12 | 2 |
| `OrthBitmapUnionCountData` instantiations | 6 | 1 |
### 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]