Repository navigation
[Fix](FoldConst) Preserve NaN in numeric constant folding - #63870
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
/review |
There was a problem hiding this comment.
No blocking findings found in the reviewed PR diff.
Critical checkpoint conclusions:
- Goal/test proof: The change fixes FE constant folding for NaN inputs in numeric math functions so folded results match BE runtime behavior, and adds both Nereids unit coverage plus regression coverage for the affected functions.
- Scope: The code change is small and localized to the shared numeric boundary helper used by executable constant folding.
- Concurrency/lifecycle/config/compatibility: Not involved; no new shared state, lifecycle-sensitive objects, config, storage format, or protocol changes.
- Parallel paths: BE runtime already treats NaN comparisons as not out-of-bound for these math functions; the FE folding path is now aligned.
- Conditions/error handling: The new NaN condition is explicit and returns non-out-of-bound so the normal Java math operation produces NaN where appropriate.
- Test coverage/results: Added FE unit assertions and regression invocations for ln/log/log2/log10/dlog10/power NaN cases. I did not run tests in this review runner.
- Observability/transactions/persistence/data writes: Not applicable.
- Performance: No meaningful performance impact.
User focus: No additional user-provided review focus was present.
TPC-H: Total hot run time: 31295 ms |
TPC-DS: Total hot run time: 171737 ms |
FE UT Coverage ReportIncrement line coverage |
FE Regression Coverage ReportIncrement line coverage |
commented
May 29, 2026
|
PR approved by at least one committer and no changes requested. |
commented
May 29, 2026
|
PR approved by anyone and no changes requested. |
commented
May 29, 2026
It could originally handle correctly |
commented
May 29, 2026
FE Regression Coverage ReportIncrement line coverage |
Problem Summary:
Some numeric functions returned different results between normal execution and FE constant folding when the input was NaN. The shared boundary helper
inputOutOfBound()treatedDouble.NaNas out of bound because range comparisons with NaN are false, causing functions such asln,log,log2,log10,dlog10, andpowerto fold NaN cases incorrectly to NULL or skip folding.before
now