EaswarKilari opened a new pull request, #12029:
URL: https://github.com/apache/arrow-rs/pull/12029

   # Which issue does this PR close?
   
   - Closes #12004
   
   # Rationale for this change
   
   `interval_mul_f64` is adapted from DuckDB's `INTERVAL * DOUBLE`, but it 
computes the sub-day remainder as `days_product.fract() + 
month_remainder.fract()`, which reassociates DuckDB's `days * factor - days + 
month_remainder - day_remainder`. Floating-point addition is not associative, 
so some results differ from DuckDB by one nanosecond. As discussed in the 
issue, align with DuckDB/PostgreSQL's order.
   
   # What changes are included in this PR?
   
   Compute the seconds remainder in DuckDB's order of operations. Months and 
days are unaffected.
   
   # Are these changes tested?
   
   Yes, a new regression test covers the case from the issue, the opposite 
rounding direction, a negative factor, and division (which multiplies by the 
reciprocal). It fails without the fix.
   
   # Are there any significant user-facing changes?
   
   Some `interval * f64` and `interval / f64` results change by one nanosecond 
to match DuckDB.
   
   AI usage: an AI assistant helped trace the code and write the regression 
test. I checked the fix against DuckDB's implementation and confirmed it 
matches DuckDB's order of operations across the issue's 212,160-case grid.
   


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

Reply via email to