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

   
   ### What problem does this PR solve?
   
   Integer-to-DecimalV3 casts with zero scale previously went through the 
generic decimal cast path even when the target decimal precision can represent 
the full integer input range. For example, casting an INT column to 
DECIMALV3(10, 0) still used the common _from_int helper, which computes decimal 
scaling and range-related values that are unnecessary when the scale is zero 
and the cast cannot narrow the integer range.
   
   Root cause: the DecimalV3 cast implementation did not have a direct fast 
path for non-narrowing integer casts to zero-scale decimal types.
   
   This change adds a direct zero-scale DecimalV3 path for integer and boolean 
inputs when the target decimal range is not narrower than the input range. The 
fast path writes the input value directly into the decimal native value and 
preserves the existing generic path for narrowing casts, non-zero-scale casts, 
and overflow-sensitive cases.
   
   Local optest profiling for:
   
       select sum(cast(quantity as decimalv3(10,0))) from q14_avg_expr_100m;
   
   showed the cast expression time improving from about 119.0 ms to about 109.7 
ms on 100M rows, roughly an 8% reduction in this expression counter.
   ### 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