kosiew commented on PR #7887:
URL: https://github.com/apache/arrow-rs/pull/7887#issuecomment-3051876283

   Thanks @tustvold for the quick feedback
   
   #### ✅ What we’re doing now (safe, slow):
   - Replace `.unwrap()` with proper error handling.
   - Use `try_unary` to safely propagate conversion errors.
   - This is correct, but may slow things down.
   
   #### 🛠 Alternative approaches (fast, risky or complex):
   
   1. **Clamp or saturate**
      - Convert what we can, and clamp values to `f64::MAX` or `f64::MIN` when 
overflow is detected.
      - Might hide data corruption; unsafe for financial data.
   
   2. **Ignore errors silently**
      - Keep using `.unary()` and fallback to `0.0` or `NaN` on error.
      - Fast but potentially dangerous and violates correctness expectations.
   
   3. **Make overflow handling configurable**
      - Introduce a `CastOptions` flag like `allow_float_overflow`.
      - Use `unary()` when allowed, `try_unary()` when strict.
      
      Which of the above (or another option) would you recommend?


-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to