TatvagnaTandel opened a new pull request, #55941:
URL: https://github.com/apache/arrow/pull/55941

   ### Rationale for this change
   
   Arrow uses Parquet row group statistics to skip groups that cannot match a 
filter. Those statistics describe the original `float64` column. When a filter 
casts that column to `float32`, rounding can move a value onto the comparison 
boundary.
   
   In the reported case, `17.799999999999997` is greater than the threshold 
`17.799999237060547` before casting. After casting to `float32`, it equals the 
threshold and should satisfy the `<=` comparison. The simplifier stripped the 
cast, so pruning compared the original `float64` bound against the threshold 
and skipped a row group that contained a match. The same problem affected `>=` 
comparisons.
   
   ### What changes are included in this PR?
   
   The expression simplifier retains narrowing floating point casts and still 
simplifies widening casts. When a widening cast wraps a narrowing cast, the 
simplifier can remove the outer cast while preserving the inner one. The patch 
leaves integer to floating point handling unchanged.
   
   ### Are these changes tested?
   
   - Added Parquet regressions for both `<=` and `>=`. Each scan returned zero 
rows before the fix and the expected matching row afterward.
   - Added expression coverage for widening, narrowing, and a narrowing cast 
nested inside a widening cast.
   - All 12 native CTest suites passed before the push.
   
   ### Are there any user-facing changes?
   
   Affected Parquet Dataset filters now return matching rows that were 
previously skipped.
   
   **Critical Fix:** The bug produced incomplete query results by dropping 
matching rows during pruning. The patch changes no public APIs.
   
   ### Was AI used for this PR?
   
   Codex generated the implementation and documentation.
   
   I personally reviewed the implementation and test.
   
   * GitHub Issue: Closes #55886


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