summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/expression_algo.cpp
diff options
context:
space:
mode:
authorScott Hernandez <scotthernandez@gmail.com>2016-07-07 12:13:07 -0400
committerScott Hernandez <scotthernandez@gmail.com>2016-07-07 12:13:13 -0400
commit0b797de3ce2eb461e82cac647067dfaaa4d36988 (patch)
tree27f4e2126c4771fefb5f64f0ca5c2468a4158f02 /src/mongo/db/matcher/expression_algo.cpp
parente7cc7ebf50c2883776cb4cc2423d687bcafa35b6 (diff)
downloadmongo-0b797de3ce2eb461e82cac647067dfaaa4d36988.tar.gz
Revert "SERVER-23882 Collation should be considered part of a query's shape"
This reverts commit 582818dac41ac01975820c09f79d3b86dc3782cc.
Diffstat (limited to 'src/mongo/db/matcher/expression_algo.cpp')
-rw-r--r--src/mongo/db/matcher/expression_algo.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/mongo/db/matcher/expression_algo.cpp b/src/mongo/db/matcher/expression_algo.cpp
index d918ead80f9..6365d3326bb 100644
--- a/src/mongo/db/matcher/expression_algo.cpp
+++ b/src/mongo/db/matcher/expression_algo.cpp
@@ -46,6 +46,19 @@ using std::unique_ptr;
namespace {
+bool isComparisonMatchExpression(const MatchExpression* expr) {
+ switch (expr->matchType()) {
+ case MatchExpression::LT:
+ case MatchExpression::LTE:
+ case MatchExpression::EQ:
+ case MatchExpression::GTE:
+ case MatchExpression::GT:
+ return true;
+ default:
+ return false;
+ }
+}
+
bool supportsEquality(const ComparisonMatchExpression* expr) {
switch (expr->matchType()) {
case MatchExpression::LTE:
@@ -140,7 +153,7 @@ bool _isSubsetOf(const MatchExpression* lhs, const ComparisonMatchExpression* rh
return false;
}
- if (ComparisonMatchExpression::isComparisonMatchExpression(lhs)) {
+ if (isComparisonMatchExpression(lhs)) {
return _isSubsetOf(static_cast<const ComparisonMatchExpression*>(lhs), rhs);
}
@@ -175,7 +188,7 @@ bool _isSubsetOf(const MatchExpression* lhs, const ExistsMatchExpression* rhs) {
return false;
}
- if (ComparisonMatchExpression::isComparisonMatchExpression(lhs)) {
+ if (isComparisonMatchExpression(lhs)) {
const ComparisonMatchExpression* cme = static_cast<const ComparisonMatchExpression*>(lhs);
// CompareMatchExpression::init() prohibits creating a match expression with EOO or
// Undefined types, so only need to ensure that the value is not of type jstNULL.
@@ -325,7 +338,7 @@ bool isSubsetOf(const MatchExpression* lhs, const MatchExpression* rhs) {
return true;
}
- if (ComparisonMatchExpression::isComparisonMatchExpression(rhs)) {
+ if (isComparisonMatchExpression(rhs)) {
return _isSubsetOf(lhs, static_cast<const ComparisonMatchExpression*>(rhs));
}