-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Optimization
-
Fully Compatible
-
ALL
-
QO 2025-02-03
> db.adminCommand({setParameter:1, planRankerMode: "heuristicCE"}) > db.createCollection("foo") > db.foo.find({a: 0}) MongoServerError: Invalid Selectivity value > maxValue: (inf > 1)
This occurs because we populate the inputCard to the CardinalityEstimator with 0. Then when calculating the selectivity of the a = 0 predicate, we end up with a division by 0.
In this ticket we should:
- Detect this case in the estimation of MatchExpression
- Add assertion to division operator to surface a divide by 0 error earlier
- Audit instances of division to ensure we check 0 case