Mryange opened a new pull request, #61227:
URL: https://github.com/apache/doris/pull/61227

   ### What problem does this PR solve?
   
   
   `scan_operator.cpp` was the 2nd slowest file to compile (~289s), caused by 
template
   instantiation blowup. Methods defined on `ScanLocalState<Derived>` were 
instantiated
   for each of the 6 `Derived` types (OlapScan, JDBCScan, FileScan, EsScan, 
MetaScan,
   GroupCommitScan). Specifically:
   
   - 4 inner `PrimitiveType`-templated methods × 6 Derived × 21 PrimitiveTypes 
= **504 instantiations**
   - 5 non-template normalize methods × 6 Derived = **30 extra compilations**
   
   None of these methods actually depend on `Derived` — they only use base 
class members
   or virtual dispatch.
   
   ## Solution
   
   Move the methods that do not depend on `Derived` up to `ScanLocalStateBase`:
   
   **Inner PrimitiveType-template methods** (instantiation reduced from 6×21 → 
21, ÷6):
   - `_normalize_in_predicate<T>`
   - `_normalize_binary_predicate<T>`
   - `_normalize_is_null_predicate<T>`
   - `_change_value_range<T, Func>`
   
   **Non-template normalize methods** (each compiled 6× → 1×):
   - `_eval_const_conjuncts`
   - `_normalize_bloom_filter`
   - `_normalize_topn_filter`
   - `_normalize_bitmap_filter`
   - `_normalize_function_filters`
   
   **Accompanying changes:**
   - Move `_should_push_down_*` virtual methods, `_eos`, `_push_down_functions` 
members
     to `ScanLocalStateBase` so the moved methods can call them without 
`Derived`.
   - Add `_max_pushdown_conditions_per_column` to base class, initialized from 
parent
     in `ScanLocalState<Derived>::init()`.
   - `_normalize_topn_filter`: replace `p.node_id()` (via `Derived::Parent` 
cast) with
     `_parent->node_id()` (base class method).
   
   
   before
   ```
   288.82s  be/src/exec/operator/scan_operator.cpp
   ```
   
   now
   ```
   [1/1] Compiling: be/src/exec/operator/scan_operator.cpp
     → 247.9s
   ```
   
   
   ### 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]

Reply via email to