summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/index_bounds_builder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/index_bounds_builder.cpp')
-rw-r--r--src/mongo/db/query/index_bounds_builder.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/mongo/db/query/index_bounds_builder.cpp b/src/mongo/db/query/index_bounds_builder.cpp
index aa05e986aed..4176823172e 100644
--- a/src/mongo/db/query/index_bounds_builder.cpp
+++ b/src/mongo/db/query/index_bounds_builder.cpp
@@ -129,11 +129,10 @@ const Interval kHashedNullInterval =
IndexBoundsBuilder::makePointInterval(ExpressionMapping::hash(kNullElementObj.firstElement()));
Interval makeUndefinedPointInterval(bool isHashed) {
- return isHashed ? kHashedUndefinedInterval
- : IndexBoundsBuilder::makePointInterval(kUndefinedElementObj);
+ return isHashed ? kHashedUndefinedInterval : IndexBoundsBuilder::kUndefinedPointInterval;
}
Interval makeNullPointInterval(bool isHashed) {
- return isHashed ? kHashedNullInterval : IndexBoundsBuilder::makePointInterval(kNullElementObj);
+ return isHashed ? kHashedNullInterval : IndexBoundsBuilder::kNullPointInterval;
}
void makeNullEqualityBounds(const IndexEntry& index,
@@ -501,6 +500,11 @@ void buildBoundsForQueryElementForGT(BSONElement dataElt,
} // namespace
+const Interval IndexBoundsBuilder::kUndefinedPointInterval =
+ IndexBoundsBuilder::makePointInterval(kUndefinedElementObj);
+const Interval IndexBoundsBuilder::kNullPointInterval =
+ IndexBoundsBuilder::makePointInterval(kNullElementObj);
+
void IndexBoundsBuilder::_translatePredicate(const MatchExpression* expr,
const BSONElement& elt,
const IndexEntry& index,
@@ -1455,4 +1459,12 @@ bool IndexBoundsBuilder::isSingleInterval(const IndexBounds& bounds,
}
}
+// static
+bool IndexBoundsBuilder::isNullInterval(const OrderedIntervalList& oil) {
+ // Checks if the the intervals are [undefined, undefined] and [null, null].
+ // Note: the order is always the same (see makeNullEqualityBounds()).
+ return 2 == oil.intervals.size() && oil.intervals[0].equals(kUndefinedPointInterval) &&
+ oil.intervals[1].equals(kNullPointInterval);
+}
+
} // namespace mongo