summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/query_planner.h
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-10-31 13:53:00 -0400
committerHari Khalsa <hkhalsa@10gen.com>2013-11-01 12:56:29 -0400
commitb9b626c584b02ae607beaf16a2c0d748ceec98e4 (patch)
treee29cc59860543d398140773e5a8cdf3bd07dedea /src/mongo/db/query/query_planner.h
parent991e6a89e5b05b4c6adb5252cb7f803785742f8d (diff)
downloadmongo-b9b626c584b02ae607beaf16a2c0d748ceec98e4.tar.gz
SERVER-10026 sort queries now go through new system
Diffstat (limited to 'src/mongo/db/query/query_planner.h')
-rw-r--r--src/mongo/db/query/query_planner.h41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/mongo/db/query/query_planner.h b/src/mongo/db/query/query_planner.h
index 26e4293459b..5803ab405af 100644
--- a/src/mongo/db/query/query_planner.h
+++ b/src/mongo/db/query/query_planner.h
@@ -141,21 +141,24 @@ namespace mongo {
/**
* If 'inArrayOperator' is false, takes ownership of 'root'.
*/
- static QuerySolutionNode* buildIndexedDataAccess(MatchExpression* root,
+ static QuerySolutionNode* buildIndexedDataAccess(const CanonicalQuery& query,
+ MatchExpression* root,
bool inArrayOperator,
const vector<IndexEntry>& indices);
/**
* Takes ownership of 'root'.
*/
- static QuerySolutionNode* buildIndexedAnd(MatchExpression* root,
+ static QuerySolutionNode* buildIndexedAnd(const CanonicalQuery& query,
+ MatchExpression* root,
bool inArrayOperator,
const vector<IndexEntry>& indices);
/**
* Takes ownership of 'root'.
*/
- static QuerySolutionNode* buildIndexedOr(MatchExpression* root,
+ static QuerySolutionNode* buildIndexedOr(const CanonicalQuery& query,
+ MatchExpression* root,
bool inArrayOperator,
const vector<IndexEntry>& indices);
@@ -172,7 +175,8 @@ namespace mongo {
*
* Does not take ownership of 'root' but may remove children from it.
*/
- static bool processIndexScans(MatchExpression* root,
+ static bool processIndexScans(const CanonicalQuery& query,
+ MatchExpression* root,
bool inArrayOperator,
const vector<IndexEntry>& indices,
vector<QuerySolutionNode*>* out);
@@ -187,7 +191,8 @@ namespace mongo {
* If the node is an index scan, the bounds for 'expr' are computed and placed into the
* first field's OIL position. The rest of the OILs are allocated but uninitialized.
*
- * If the node is a geo node, XXX.
+ * If the node is a geo node, grab the geo data from 'expr' and stuff it into the
+ * geo solution node of the appropriate type.
*/
static QuerySolutionNode* makeLeafNode(const IndexEntry& index,
MatchExpression* expr,
@@ -201,23 +206,14 @@ namespace mongo {
MatchExpression::MatchType mergeType);
/**
- * If index scan, fill in any bounds that are missing in 'node' with the "all values for
- * this field" interval.
+ * If index scan (regular or expression index), fill in any bounds that are missing in
+ * 'node' with the "all values for this field" interval.
*
- * If geo, XXX.
+ * If geo, do nothing.
*/
static void finishLeafNode(QuerySolutionNode* node, const IndexEntry& index);
//
- // Helpers for creating a sort.
- //
-
- /**
- * XXX
- */
- static void getBoundsForSort(const CanonicalQuery& query, SortNode* node);
-
- //
// Analysis of Data Access
//
@@ -246,7 +242,7 @@ namespace mongo {
const CanonicalQuery& query);
/**
- * XXX
+ * Traverse the tree rooted at 'root' reversing ixscans and other sorts.
*/
static void reverseScans(QuerySolutionNode* root);
@@ -257,7 +253,16 @@ namespace mongo {
*/
static void alignBounds(IndexBounds* bounds, const BSONObj& kp, int scanDir = 1);
+ /**
+ * Does the index with key pattern 'kp' provide the sort that 'query' wants?
+ */
static bool providesSort(const CanonicalQuery& query, const BSONObj& kp);
+
+ /**
+ * Get the bounds for the sort in 'query' used by the sort stage. Output the bounds
+ * in 'node'.
+ */
+ static void getBoundsForSort(const CanonicalQuery& query, SortNode* node);
};
} // namespace mongo