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

   ### What problem does this PR solve?
   
   
   `function_datetime_floor_ceil.cpp` has excessive template instantiation 
bloat. The class `FunctionDateTimeFloorCeil<Flag, PType, ArgNum, UseDelta>` has 
4 template parameters, producing 192 instantiations. However, all heavy 
computation functions (9 `vector_*` variants, `time_round_two_args`, 
`floor_opt`, etc.) only depend on `Flag` and `PType` โ€” they never use `ArgNum` 
or `UseDelta`. This means these expensive functions are compiled 4x more than 
necessary.
   
   This PR applies three optimizations:
   
   1. **Extract `DateTimeFloorCeilCore<Flag, PType>` struct**: All heavy 
computation functions are moved into a separate struct with only 2 template 
parameters. `FunctionDateTimeFloorCeil` becomes a thin shell that delegates to 
`Core::vector_*()`. This reduces instantiations of the heaviest code from **192 
โ†’ 48** (รท4).
   
   2. **Extract `convert_utc_to_local_impl<DateValueType>` free function**: 
This function only depends on `DateValueType`, not `Flag`/`ArgNum`/`UseDelta`. 
Extracting it reduces its instantiations from 192 โ†’ 3.
   
   3. **Extract `FunctionDateTimeFloorCeilBase` non-template base class**: 
Three virtual overrides (`get_number_of_arguments`, `is_variadic`, 
`use_default_implementation_for_nulls`) use zero template parameters. Moving 
them to a non-template base eliminates 192 redundant copies.
   
   
   
   ### 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