emanuele-em opened a new pull request, #26412:
URL: https://github.com/apache/datafusion/pull/26412

   ## Which issue does this PR close?
   
   - Closes #7356.
   
   ## Rationale for this change
   
   A caught panic in `alter_fp_rounding_mode` leaves the thread using the 
temporary rounding mode, which can affect later floating-point calculations on 
that thread.
   
   ## What changes are included in this PR?
   
   Restore the saved rounding mode with a private `Drop` guard so cleanup also 
runs during unwinding. The change is confined to `rounding.rs` and adds no 
dependency or public API.
   
   ## What is the testing strategy for this PR?
   
   The regression test starts in downward rounding mode, panics during an 
upward-rounded operation, catches the panic, and checks that downward rounding 
was restored. It restores the test thread's original mode before asserting. 
This requires a Rust unit test because SQL and the DataFrame API cannot 
directly supply the panicking callback.
   
   The test was run against the unfixed implementation and failed because 
upward rounding remained active.
   
   Validation:
   
   - `cargo fmt --all` and `cargo fmt --all -- --check` passed.
   - `cargo test --profile ci -p datafusion-common -p datafusion-expr-common` 
passed: 847 unit tests and 89 documentation tests, with five documentation 
tests ignored.
   
   `cargo clippy --all-targets --all-features -- -D warnings` reported three 
pre-existing `mutable_key_type` errors in 
`datafusion/optimizer/src/push_down_filter.rs`, tracked by #26181. Its 
remaining bundled Protobuf build was stopped after these errors.
   
   The full lint suite, SQL logic suite, and extended workspace tests were 
started but did not complete locally. The separate core and CLI test run was 
not reached.
   
   ## Are there any user-facing changes?
   
   After a caught panic, subsequent floating-point calculations on the same 
thread retain the rounding mode that was active before the operation. No public 
API or normal SQL behavior changes.
   


-- 
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