[SERVER-18350] Add special handling of NaN for whether query can be answered by a partial index Created: 06/May/15  Updated: 02/Aug/18  Resolved: 14/May/15

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 3.1.3

Type: Task Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Max Hirschhorn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

Should match the special handling for NaN values that ComparisonMatchExpression::matchesSingleElement() does:

// Special case handling for NaN. NaN is equal to NaN but
// otherwise always compares to false.
if (std::isnan(e.numberDouble()) || std::isnan(_rhs.numberDouble())) {
    bool bothNaN = std::isnan(e.numberDouble()) && std::isnan(_rhs.numberDouble());
    switch ( matchType() ) {
    case LT:
        return false;
    case LTE:
        return bothNaN;
    case EQ:
        return bothNaN;
    case GT:
        return false;
    case GTE:
        return bothNaN;
    default:
        // This is a comparison match expression, so it must be either
        // a $lt, $lte, $gt, $gte, or equality expression.
        fassertFailed( 17448 );
    }
}



 Comments   
Comment by Githook User [ 14/May/15 ]

Author:

{u'username': u'visemet', u'name': u'Max Hirschhorn', u'email': u'max.hirschhorn@mongodb.com'}

Message: SERVER-18350 Refactor expression_algo.cpp.

Added special handling for NaN values to be consistent with what
ComparisonMatchExpression::matchesSingleElement() does.

Added support for a point query to be answered by a partial index with
a range filter over a single field.

Changed to use static_cast instead of dynamic_cast because the
MatchExpression subclass is known based on the matchType().
Branch: master
https://github.com/mongodb/mongo/commit/eede63734af75cb50d5731e2677359fd8b067a0c

Generated at Thu Feb 08 03:47:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.