mikamikasuki opened a new pull request, #68738:
URL: https://github.com/apache/doris/pull/68738
### What problem does this PR solve?
Issue Number: close #68718
Related PR: None
Problem Summary: For DOUBLE input 1e20 and scale -25, BE returns
9.223372036854776e+19 while FE returns 0. BE uses `int_exp10` to calculate the
scale, which saturates at UINT64_MAX for exponents above 19.
This change handles FLOAT/DOUBLE scales outside [-19, 19] using
floating-point powers of ten while preserving the rounding mode. Scales within
[-19, 19] keep the existing path. It covers round, bankers rounding, truncate,
floor, and ceil across constant and vector inputs/scales.
### Release note
Correct BE FLOAT/DOUBLE round/floor/ceil/truncate results for extreme scales
to match FE.
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [x] 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
Added `RoundFunctionTest.large_float_scales`, covering FLOAT and DOUBLE,
constant and vector inputs/scales, all five rounding functions, and boundary
scales including 20, -19, -20, -25, and the Int16 minimum.
Command: `ENABLE_PCH=ON ./run-be-ut.sh --run
--filter=RoundFunctionTest.large_float_scales -j 6`
Environment: ASAN_UT build, Clang 20.1.7, x86_64 Linux under
Colima/Rosetta.
Result: the backend code and test sources compiled and `doris_be_test`
linked successfully, but the test has not been executed. The process exited
with code 132 (`Illegal instruction (core dumped)`) at startup, before
GoogleTest produced any results. Runtime validation is pending CI.
Static checks (not tests): clang-format 16, `git diff --check`, and
`./build-support/check-build-hygiene.sh` passed.
- Behavior changed:
- [ ] No.
- [x] Yes. Extreme FLOAT/DOUBLE scales no longer use a saturated integer
scaling factor, so results now match FE (e.g. `round(1e20, -25)` returns 0).
- Does this need documentation?
- [x] 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]