mhatipog opened a new pull request, #60525:
URL: https://github.com/apache/spark/pull/60525

   ### What changes were proposed in this pull request?
   
   `FilterEstimation.evaluateBinaryForNumeric` returns selectivity 0 when the 
column's distinct count is 0.
   
   ### Why are the changes needed?
   
   An earlier estimate can leave a column with min/max set and `distinctCount = 
0` (e.g. `p.a < 1` plus the inferred `p.a > 0`). At the boundary cases `1.0 / 
ndv` is infinite, `ceil(0 * -Infinity)` is NaN, and the BigDecimal conversion 
throws `NumberFormatException`. Repro in SPARK-61741. SPARK-23799 added the 
same guard to `evaluateInSet`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, planning no longer fails with CBO enabled in this case.
   
   ### How was this patch tested?
   
   Two tests in `FilterEstimationSuite`: direct zero-NDV statistics, and valid 
statistics that reach zero NDV through repeated ranges. Both fail without the 
change.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)
   


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