diff options
Diffstat (limited to 'src/mongo/db/query')
24 files changed, 118 insertions, 117 deletions
diff --git a/src/mongo/db/query/canonical_query.cpp b/src/mongo/db/query/canonical_query.cpp index cba8c2e2736..03424a838d6 100644 --- a/src/mongo/db/query/canonical_query.cpp +++ b/src/mongo/db/query/canonical_query.cpp @@ -299,7 +299,7 @@ void CanonicalQuery::sortTree(MatchExpression* tree) { sortTree(tree->getChild(i)); } std::vector<MatchExpression*>* children = tree->getChildVector(); - if (NULL != children) { + if (nullptr != children) { std::sort(children->begin(), children->end(), matchExpressionLessThan); } } diff --git a/src/mongo/db/query/explain.cpp b/src/mongo/db/query/explain.cpp index 977b7fdb1a1..4f6093959b4 100644 --- a/src/mongo/db/query/explain.cpp +++ b/src/mongo/db/query/explain.cpp @@ -669,7 +669,7 @@ void Explain::generatePlannerInfo(PlanExecutor* exec, // In general we should have a canonical query, but sometimes we may avoid // creating a canonical query as an optimization (specifically, the update system // does not canonicalize for idhack updates). In these cases, 'query' is NULL. - if (NULL != query) { + if (nullptr != query) { BSONObjBuilder parsedQueryBob(plannerBob.subobjStart("parsedQuery")); query->root()->serialize(&parsedQueryBob); parsedQueryBob.doneFast(); @@ -938,7 +938,7 @@ std::string Explain::getPlanSummary(const PlanStage* root) { // static void Explain::getSummaryStats(const PlanExecutor& exec, PlanSummaryStats* statsOut) { - invariant(NULL != statsOut); + invariant(nullptr != statsOut); PlanStage* root = exec.getRootStage(); diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp index ff1e443abc9..0a47bc2ce0a 100644 --- a/src/mongo/db/query/find.cpp +++ b/src/mongo/db/query/find.cpp @@ -182,7 +182,7 @@ void generateBatch(int ntoreturn, BSONObj obj; while (!FindCommon::enoughForGetMore(ntoreturn, *numResults) && - PlanExecutor::ADVANCED == (*state = exec->getNext(&obj, NULL))) { + PlanExecutor::ADVANCED == (*state = exec->getNext(&obj, nullptr))) { // If we can't fit this result inside the current batch, then we stash it for later. if (!FindCommon::haveSpaceForNext(obj, *numResults, bb->len())) { exec->enqueue(obj); @@ -680,7 +680,7 @@ std::string runQuery(OperationContext* opCtx, curOp.setPlanSummary_inlock(Explain::getPlanSummary(exec.get())); } - while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, NULL))) { + while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, nullptr))) { // If we can't fit this result inside the current batch, then we stash it for later. if (!FindCommon::haveSpaceForNext(obj, numResults, bb.len())) { exec->enqueue(obj); diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index 5d82c6bc539..da9207b93f6 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -370,7 +370,7 @@ StatusWith<PrepareExecutionResult> prepareExecution(OperationContext* opCtx, unique_ptr<PlanStage> root; // This can happen as we're called by internal clients as well. - if (NULL == collection) { + if (nullptr == collection) { const string& ns = canonicalQuery->ns(); LOG(2) << "Collection " << ns << " does not exist." << " Using EOF plan: " << redact(canonicalQuery->toStringShort()); @@ -745,7 +745,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> _getExecutorFind( unique_ptr<CanonicalQuery> canonicalQuery, PlanExecutor::YieldPolicy yieldPolicy, size_t plannerOptions) { - if (NULL != collection && canonicalQuery->getQueryRequest().isOplogReplay()) { + if (nullptr != collection && canonicalQuery->getQueryRequest().isOplogReplay()) { return getOplogStartHack( opCtx, collection, std::move(canonicalQuery), plannerOptions, yieldPolicy); } @@ -1131,7 +1131,7 @@ bool turnIxscanIntoCount(QuerySolution* soln) { return false; } - if (STAGE_FETCH == root->getType() && NULL != root->filter.get()) { + if (STAGE_FETCH == root->getType() && nullptr != root->filter.get()) { return false; } @@ -1148,7 +1148,7 @@ bool turnIxscanIntoCount(QuerySolution* soln) { // isSimpleRange here? because we could well use it. I just don't think we ever do see // it. - if (NULL != isn->filter.get() || isn->bounds.isSimpleRange) { + if (nullptr != isn->filter.get() || isn->bounds.isSimpleRange) { return false; } diff --git a/src/mongo/db/query/index_tag.cpp b/src/mongo/db/query/index_tag.cpp index 0381e2ac9ba..61e0204d3da 100644 --- a/src/mongo/db/query/index_tag.cpp +++ b/src/mongo/db/query/index_tag.cpp @@ -45,12 +45,12 @@ namespace { bool TagComparison(const MatchExpression* lhs, const MatchExpression* rhs) { IndexTag* lhsTag = static_cast<IndexTag*>(lhs->getTag()); - size_t lhsValue = (NULL == lhsTag) ? IndexTag::kNoIndex : lhsTag->index; - size_t lhsPos = (NULL == lhsTag) ? IndexTag::kNoIndex : lhsTag->pos; + size_t lhsValue = (nullptr == lhsTag) ? IndexTag::kNoIndex : lhsTag->index; + size_t lhsPos = (nullptr == lhsTag) ? IndexTag::kNoIndex : lhsTag->pos; IndexTag* rhsTag = static_cast<IndexTag*>(rhs->getTag()); - size_t rhsValue = (NULL == rhsTag) ? IndexTag::kNoIndex : rhsTag->index; - size_t rhsPos = (NULL == rhsTag) ? IndexTag::kNoIndex : rhsTag->pos; + size_t rhsValue = (nullptr == rhsTag) ? IndexTag::kNoIndex : rhsTag->index; + size_t rhsPos = (nullptr == rhsTag) ? IndexTag::kNoIndex : rhsTag->pos; // First, order on indices. if (lhsValue != rhsValue) { @@ -94,7 +94,7 @@ void sortUsingTags(MatchExpression* tree) { sortUsingTags(tree->getChild(i)); } std::vector<MatchExpression*>* children = tree->getChildVector(); - if (NULL != children) { + if (nullptr != children) { std::sort(children->begin(), children->end(), TagComparison); } } diff --git a/src/mongo/db/query/index_tag.h b/src/mongo/db/query/index_tag.h index be4423d3179..ac69dc16870 100644 --- a/src/mongo/db/query/index_tag.h +++ b/src/mongo/db/query/index_tag.h @@ -88,7 +88,7 @@ public: // used internally class RelevantTag : public MatchExpression::TagData { public: - RelevantTag() : elemMatchExpr(NULL), pathPrefix("") {} + RelevantTag() : elemMatchExpr(nullptr), pathPrefix("") {} std::vector<size_t> first; std::vector<size_t> notFirst; diff --git a/src/mongo/db/query/internal_plans.cpp b/src/mongo/db/query/internal_plans.cpp index bfd88fb27df..2fa5359bd48 100644 --- a/src/mongo/db/query/internal_plans.cpp +++ b/src/mongo/db/query/internal_plans.cpp @@ -55,7 +55,7 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> InternalPlanner::collection const RecordId startLoc) { std::unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); - if (NULL == collection) { + if (nullptr == collection) { auto eof = std::make_unique<EOFStage>(opCtx); // Takes ownership of 'ws' and 'eof'. auto statusWithPlanExecutor = PlanExecutor::make( diff --git a/src/mongo/db/query/lru_key_value_test.cpp b/src/mongo/db/query/lru_key_value_test.cpp index 6b9ee7b90d6..9f15aad6c9a 100644 --- a/src/mongo/db/query/lru_key_value_test.cpp +++ b/src/mongo/db/query/lru_key_value_test.cpp @@ -41,7 +41,7 @@ namespace { // void assertInKVStore(LRUKeyValue<int, int>& cache, int key, int value) { - int* cachedValue = NULL; + int* cachedValue = nullptr; ASSERT_TRUE(cache.hasKey(key)); Status s = cache.get(key, &cachedValue); ASSERT_OK(s); @@ -49,7 +49,7 @@ void assertInKVStore(LRUKeyValue<int, int>& cache, int key, int value) { } void assertNotInKVStore(LRUKeyValue<int, int>& cache, int key) { - int* cachedValue = NULL; + int* cachedValue = nullptr; ASSERT_FALSE(cache.hasKey(key)); Status s = cache.get(key, &cachedValue); ASSERT_NOT_OK(s); @@ -99,7 +99,7 @@ TEST(LRUKeyValueTest, EvictionTest) { LRUKeyValue<int, int> cache(maxSize); for (int i = 0; i < maxSize; ++i) { std::unique_ptr<int> evicted = cache.add(i, new int(i)); - ASSERT(NULL == evicted.get()); + ASSERT(nullptr == evicted.get()); } ASSERT_EQUALS(cache.size(), (size_t)maxSize); @@ -115,7 +115,7 @@ TEST(LRUKeyValueTest, EvictionTest) { // Adding another entry causes an eviction. std::unique_ptr<int> evicted = cache.add(maxSize + 1, new int(maxSize + 1)); ASSERT_EQUALS(cache.size(), (size_t)maxSize); - ASSERT(NULL != evicted.get()); + ASSERT(nullptr != evicted.get()); ASSERT_EQUALS(*evicted, evictKey); // Check that the least recently accessed has been evicted. @@ -139,7 +139,7 @@ TEST(LRUKeyValueTest, PromotionTest) { LRUKeyValue<int, int> cache(maxSize); for (int i = 0; i < maxSize; ++i) { std::unique_ptr<int> evicted = cache.add(i, new int(i)); - ASSERT(NULL == evicted.get()); + ASSERT(nullptr == evicted.get()); } ASSERT_EQUALS(cache.size(), (size_t)maxSize); @@ -150,7 +150,7 @@ TEST(LRUKeyValueTest, PromotionTest) { // Evict all but one of the original entries. for (int i = maxSize; i < (maxSize + maxSize - 1); ++i) { std::unique_ptr<int> evicted = cache.add(i, new int(i)); - ASSERT(NULL != evicted.get()); + ASSERT(nullptr != evicted.get()); } ASSERT_EQUALS(cache.size(), (size_t)maxSize); diff --git a/src/mongo/db/query/parsed_projection_test.cpp b/src/mongo/db/query/parsed_projection_test.cpp index 84669166c8d..075858687fd 100644 --- a/src/mongo/db/query/parsed_projection_test.cpp +++ b/src/mongo/db/query/parsed_projection_test.cpp @@ -58,7 +58,7 @@ unique_ptr<ParsedProjection> createParsedProjection(const BSONObj& query, const MatchExpressionParser::parse(query, std::move(expCtx)); ASSERT(statusWithMatcher.isOK()); std::unique_ptr<MatchExpression> queryMatchExpr = std::move(statusWithMatcher.getValue()); - ParsedProjection* out = NULL; + ParsedProjection* out = nullptr; Status status = ParsedProjection::make(opCtx.get(), projObj, queryMatchExpr.get(), &out); if (!status.isOK()) { FAIL(str::stream() << "failed to parse projection " << projObj << " (query: " << query @@ -91,7 +91,7 @@ void assertInvalidProjection(const char* queryStr, const char* projStr) { MatchExpressionParser::parse(query, std::move(expCtx)); ASSERT(statusWithMatcher.isOK()); std::unique_ptr<MatchExpression> queryMatchExpr = std::move(statusWithMatcher.getValue()); - ParsedProjection* out = NULL; + ParsedProjection* out = nullptr; Status status = ParsedProjection::make(opCtx.get(), projObj, queryMatchExpr.get(), &out); std::unique_ptr<ParsedProjection> destroy(out); ASSERT(!status.isOK()); @@ -213,9 +213,9 @@ TEST(ParsedProjectionTest, InvalidPositionalProjectionDefaultPathMatchExpression QueryTestServiceContext serviceCtx; auto opCtx = serviceCtx.makeOperationContext(); unique_ptr<MatchExpression> queryMatchExpr(new AlwaysFalseMatchExpression()); - ASSERT(NULL == queryMatchExpr->path().rawData()); + ASSERT(nullptr == queryMatchExpr->path().rawData()); - ParsedProjection* out = NULL; + ParsedProjection* out = nullptr; BSONObj projObj = fromjson("{'a.$': 1}"); Status status = ParsedProjection::make(opCtx.get(), projObj, queryMatchExpr.get(), &out); ASSERT(!status.isOK()); diff --git a/src/mongo/db/query/plan_cache.cpp b/src/mongo/db/query/plan_cache.cpp index ba32ff91e7f..3464c22a86f 100644 --- a/src/mongo/db/query/plan_cache.cpp +++ b/src/mongo/db/query/plan_cache.cpp @@ -269,7 +269,7 @@ void PlanCacheIndexTree::setIndexEntry(const IndexEntry& ie) { PlanCacheIndexTree* PlanCacheIndexTree::clone() const { PlanCacheIndexTree* root = new PlanCacheIndexTree(); - if (NULL != entry.get()) { + if (nullptr != entry.get()) { root->index_pos = index_pos; root->setIndexEntry(*entry.get()); root->canCombineBounds = canCombineBounds; @@ -298,7 +298,7 @@ std::string PlanCacheIndexTree::toString(int indents) const { return result.str(); } else { result << std::string(3 * indents, '-') << "Leaf "; - if (NULL != entry.get()) { + if (nullptr != entry.get()) { result << entry->identifier << ", pos: " << index_pos << ", can combine? " << canCombineBounds; } @@ -326,7 +326,7 @@ std::string PlanCacheIndexTree::toString(int indents) const { SolutionCacheData* SolutionCacheData::clone() const { SolutionCacheData* other = new SolutionCacheData(); - if (NULL != this->tree.get()) { + if (nullptr != this->tree.get()) { // 'tree' could be NULL if the cached solution // is a collection scan. other->tree.reset(this->tree->clone()); @@ -542,7 +542,7 @@ Status PlanCache::set(const CanonicalQuery& query, std::unique_ptr<PlanCacheEntry> evictedEntry = _cache.add(key, newEntry.release()); - if (NULL != evictedEntry.get()) { + if (nullptr != evictedEntry.get()) { LOG(1) << _ns << ": plan cache maximum size exceeded - " << "removed least recently used entry " << redact(evictedEntry->toString()); } diff --git a/src/mongo/db/query/plan_cache_test.cpp b/src/mongo/db/query/plan_cache_test.cpp index c6543f5da59..a2ab4e1f475 100644 --- a/src/mongo/db/query/plan_cache_test.cpp +++ b/src/mongo/db/query/plan_cache_test.cpp @@ -1161,7 +1161,7 @@ protected: dumpSolutions(ss); FAIL(ss); - return NULL; + return nullptr; } /** @@ -1216,8 +1216,8 @@ protected: */ void assertNotCached(const string& solnJson) { QuerySolution* bestSoln = firstMatchingSolution(solnJson); - ASSERT(NULL != bestSoln); - ASSERT(NULL == bestSoln->cacheData.get()); + ASSERT(nullptr != bestSoln); + ASSERT(nullptr == bestSoln->cacheData.get()); } static const PlanCacheKey ck; diff --git a/src/mongo/db/query/plan_enumerator.cpp b/src/mongo/db/query/plan_enumerator.cpp index 19f2188f303..7163d69e474 100644 --- a/src/mongo/db/query/plan_enumerator.cpp +++ b/src/mongo/db/query/plan_enumerator.cpp @@ -290,7 +290,7 @@ std::string PlanEnumerator::dumpMemo() { } string PlanEnumerator::NodeAssignment::toString() const { - if (NULL != andAssignment) { + if (nullptr != andAssignment) { str::stream ss; ss << "AND enumstate counter " << andAssignment->counter; for (size_t i = 0; i < andAssignment->choices.size(); ++i) { @@ -316,7 +316,7 @@ string PlanEnumerator::NodeAssignment::toString() const { } } return ss; - } else if (NULL != arrayAssignment) { + } else if (nullptr != arrayAssignment) { str::stream ss; ss << "ARRAY SUBNODES enumstate " << arrayAssignment->counter << "/ ONE OF: [ "; for (size_t i = 0; i < arrayAssignment->subnodes.size(); ++i) { @@ -325,7 +325,7 @@ string PlanEnumerator::NodeAssignment::toString() const { ss << "]"; return ss; } else { - verify(NULL != orAssignment); + verify(nullptr != orAssignment); str::stream ss; ss << "ALL OF: [ "; for (size_t i = 0; i < orAssignment->subnodes.size(); ++i) { @@ -506,7 +506,7 @@ bool PlanEnumerator::prepMemo(MatchExpression* node, PrepMemoContext context) { // There can only be one mandatory predicate (at most one $text, at most one // $geoNear, can't combine $text/$geoNear). - MatchExpression* mandatoryPred = NULL; + MatchExpression* mandatoryPred = nullptr; // There could be multiple indices which we could use to satisfy the mandatory // predicate. Keep the set of such indices. Currently only one text index is @@ -528,7 +528,7 @@ bool PlanEnumerator::prepMemo(MatchExpression* node, PrepMemoContext context) { // This should include only TEXT and GEO_NEAR preds. // We expect either 0 or 1 mandatory predicates. - invariant(NULL == mandatoryPred); + invariant(nullptr == mandatoryPred); // Mandatory predicates are TEXT or GEO_NEAR. invariant(MatchExpression::TEXT == child->matchType() || @@ -577,7 +577,7 @@ bool PlanEnumerator::prepMemo(MatchExpression* node, PrepMemoContext context) { return true; } - if (NULL != mandatoryPred) { + if (nullptr != mandatoryPred) { // We must have at least one index which can be used to answer 'mandatoryPred'. invariant(!mandatoryIndices.empty()); return enumerateMandatoryIndex( @@ -1325,7 +1325,7 @@ void PlanEnumerator::getMultikeyCompoundablePreds(const vector<MatchExpression*> // initializing the top-level scope with the prefix of the full path. for (size_t i = 0; i < assigned.size(); i++) { const MatchExpression* assignedPred = assigned[i]; - invariant(NULL != assignedPred->getTag()); + invariant(nullptr != assignedPred->getTag()); RelevantTag* usedRt = static_cast<RelevantTag*>(assignedPred->getTag()); set<string> usedPrefixes; usedPrefixes.insert(getPathPrefix(usedRt->path)); @@ -1336,7 +1336,7 @@ void PlanEnumerator::getMultikeyCompoundablePreds(const vector<MatchExpression*> // the $elemMatch context. For example, if 'assigned' is {a: {$elemMatch: {b: 1}}}, // then we will have already added "a" to the set for NULL. We now // also need to add "b" to the set for the $elemMatch. - if (NULL != usedRt->elemMatchExpr) { + if (nullptr != usedRt->elemMatchExpr) { set<string> elemMatchUsed; // Whereas getPathPrefix(usedRt->path) is the prefix of the full path, // usedRt->pathPrefix contains the prefix of the portion of the @@ -1570,17 +1570,17 @@ void PlanEnumerator::compound(const vector<MatchExpression*>& tryCompound, void PlanEnumerator::tagMemo(size_t id) { LOG(5) << "Tagging memoID " << id; NodeAssignment* assign = _memo[id]; - verify(NULL != assign); + verify(nullptr != assign); - if (NULL != assign->orAssignment) { + if (nullptr != assign->orAssignment) { OrAssignment* oa = assign->orAssignment.get(); for (size_t i = 0; i < oa->subnodes.size(); ++i) { tagMemo(oa->subnodes[i]); } - } else if (NULL != assign->arrayAssignment) { + } else if (nullptr != assign->arrayAssignment) { ArrayAssignment* aa = assign->arrayAssignment.get(); tagMemo(aa->subnodes[aa->counter]); - } else if (NULL != assign->andAssignment) { + } else if (nullptr != assign->andAssignment) { AndAssignment* aa = assign->andAssignment.get(); verify(aa->counter < aa->choices.size()); @@ -1622,9 +1622,9 @@ void PlanEnumerator::tagMemo(size_t id) { bool PlanEnumerator::nextMemo(size_t id) { NodeAssignment* assign = _memo[id]; - verify(NULL != assign); + verify(nullptr != assign); - if (NULL != assign->orAssignment) { + if (nullptr != assign->orAssignment) { OrAssignment* oa = assign->orAssignment.get(); // Limit the number of OR enumerations @@ -1644,7 +1644,7 @@ bool PlanEnumerator::nextMemo(size_t id) { } // If we're here, the last subnode had a carry, therefore the OR has a carry. return true; - } else if (NULL != assign->arrayAssignment) { + } else if (nullptr != assign->arrayAssignment) { ArrayAssignment* aa = assign->arrayAssignment.get(); // moving to next on current subnode is OK if (!nextMemo(aa->subnodes[aa->counter])) { @@ -1657,7 +1657,7 @@ bool PlanEnumerator::nextMemo(size_t id) { } aa->counter = 0; return true; - } else if (NULL != assign->andAssignment) { + } else if (nullptr != assign->andAssignment) { AndAssignment* aa = assign->andAssignment.get(); // One of our subnodes might have to move on to its next enumeration state. diff --git a/src/mongo/db/query/plan_enumerator.h b/src/mongo/db/query/plan_enumerator.h index 0ae89741132..33c7923119e 100644 --- a/src/mongo/db/query/plan_enumerator.h +++ b/src/mongo/db/query/plan_enumerator.h @@ -158,7 +158,7 @@ private: }; struct PrepMemoContext { - PrepMemoContext() : elemMatchExpr(NULL) {} + PrepMemoContext() : elemMatchExpr(nullptr) {} MatchExpression* elemMatchExpr; // Maps from indexable predicates that can be pushed into the current node to the route diff --git a/src/mongo/db/query/plan_executor_impl.cpp b/src/mongo/db/query/plan_executor_impl.cpp index 849993364c5..0ff05e2bd27 100644 --- a/src/mongo/db/query/plan_executor_impl.cpp +++ b/src/mongo/db/query/plan_executor_impl.cpp @@ -122,7 +122,7 @@ PlanStage* getStageByType(PlanStage* root, StageType type) { } } - return NULL; + return nullptr; } } // namespace @@ -379,7 +379,7 @@ void PlanExecutorImpl::reattachToOperationContext(OperationContext* opCtx) { PlanExecutor::ExecState PlanExecutorImpl::getNext(BSONObj* objOut, RecordId* dlOut) { Snapshotted<BSONObj> snapshotted; - ExecState state = _getNextImpl(objOut ? &snapshotted : NULL, dlOut); + ExecState state = _getNextImpl(objOut ? &snapshotted : nullptr, dlOut); if (objOut) { *objOut = snapshotted.value(); @@ -483,7 +483,7 @@ PlanExecutor::ExecState PlanExecutorImpl::_getNextImpl(Snapshotted<BSONObj>* obj invariant(_currentState == kUsable); if (isMarkedAsKilled()) { - if (NULL != objOut) { + if (nullptr != objOut) { *objOut = Snapshotted<BSONObj>(SnapshotId(), WorkingSetCommon::buildMemberStatusObject(_killStatus)); } @@ -535,7 +535,7 @@ PlanExecutor::ExecState PlanExecutorImpl::_getNextImpl(Snapshotted<BSONObj>* obj WorkingSetMember* member = _workingSet->get(id); bool hasRequestedData = true; - if (NULL != objOut) { + if (nullptr != objOut) { if (WorkingSetMember::RID_AND_IDX == member->getState()) { if (1 != member->keyData.size()) { _workingSet->free(id); @@ -553,7 +553,7 @@ PlanExecutor::ExecState PlanExecutorImpl::_getNextImpl(Snapshotted<BSONObj>* obj } } - if (NULL != dlOut) { + if (nullptr != dlOut) { if (member->hasRecordId()) { *dlOut = member->recordId; } else { @@ -602,7 +602,7 @@ PlanExecutor::ExecState PlanExecutorImpl::_getNextImpl(Snapshotted<BSONObj>* obj } else { invariant(PlanStage::FAILURE == code); - if (NULL != objOut) { + if (nullptr != objOut) { BSONObj statusObj; invariant(WorkingSet::INVALID_ID != id); WorkingSetCommon::getStatusMemberObject(*_workingSet, id, &statusObj); @@ -641,7 +641,7 @@ Status PlanExecutorImpl::executePlan() { BSONObj obj; PlanExecutor::ExecState state = PlanExecutor::ADVANCED; while (PlanExecutor::ADVANCED == state) { - state = this->getNext(&obj, NULL); + state = this->getNext(&obj, nullptr); } if (PlanExecutor::FAILURE == state) { diff --git a/src/mongo/db/query/planner_access.cpp b/src/mongo/db/query/planner_access.cpp index 9ac03670c3a..ef4ef25bcac 100644 --- a/src/mongo/db/query/planner_access.cpp +++ b/src/mongo/db/query/planner_access.cpp @@ -205,7 +205,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::makeLeafNode( auto ret = std::make_unique<GeoNear2DNode>(index); ret->nq = &nearExpr->getData(); ret->baseBounds.fields.resize(index.keyPattern.nFields()); - if (NULL != query.getProj()) { + if (nullptr != query.getProj()) { ret->addPointMeta = query.getProj()->wantGeoNearPoint(); ret->addDistMeta = query.getProj()->wantGeoNearDistance(); } @@ -215,7 +215,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::makeLeafNode( auto ret = std::make_unique<GeoNear2DSphereNode>(index); ret->nq = &nearExpr->getData(); ret->baseBounds.fields.resize(index.keyPattern.nFields()); - if (NULL != query.getProj()) { + if (nullptr != query.getProj()) { ret->addPointMeta = query.getProj()->wantGeoNearPoint(); ret->addDistMeta = query.getProj()->wantGeoNearDistance(); } @@ -266,11 +266,11 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::makeLeafNode( bool QueryPlannerAccess::shouldMergeWithLeaf(const MatchExpression* expr, const ScanBuildingState& scanState) { const QuerySolutionNode* node = scanState.currentScan.get(); - if (NULL == node || NULL == expr) { + if (nullptr == node || nullptr == expr) { return false; } - if (NULL == scanState.ixtag) { + if (nullptr == scanState.ixtag) { return false; } @@ -340,7 +340,7 @@ bool QueryPlannerAccess::shouldMergeWithLeaf(const MatchExpression* expr, void QueryPlannerAccess::mergeWithLeafNode(MatchExpression* expr, ScanBuildingState* scanState) { QuerySolutionNode* node = scanState->currentScan.get(); - invariant(NULL != node); + invariant(nullptr != node); const MatchExpression::MatchType mergeType = scanState->root->matchType(); size_t pos = scanState->ixtag->pos; @@ -369,7 +369,7 @@ void QueryPlannerAccess::mergeWithLeafNode(MatchExpression* expr, ScanBuildingSt return; } - IndexBounds* boundsToFillOut = NULL; + IndexBounds* boundsToFillOut = nullptr; if (STAGE_GEO_NEAR_2D == type) { invariant(INDEX_2D == index.type); @@ -459,7 +459,7 @@ void QueryPlannerAccess::finishTextNode(QuerySolutionNode* node, const IndexEntr // We can't create a text stage if there aren't EQ predicates on its prefix terms. So // if we've made it this far, we should have collected the prefix predicates in the // filter. - invariant(NULL != tn->filter.get()); + invariant(nullptr != tn->filter.get()); MatchExpression* textFilterMe = tn->filter.get(); BSONObjBuilder prefixBob; @@ -489,10 +489,10 @@ void QueryPlannerAccess::finishTextNode(QuerySolutionNode* node, const IndexEntr while (curChild < amExpr->numChildren()) { MatchExpression* child = amExpr->getChild(curChild); IndexTag* ixtag = static_cast<IndexTag*>(child->getTag()); - invariant(NULL != ixtag); + invariant(nullptr != ixtag); // Skip this child if it's not part of a prefix, or if we've already assigned a // predicate to this prefix position. - if (ixtag->pos >= tn->numPrefixFields || prefixExprs[ixtag->pos] != NULL) { + if (ixtag->pos >= tn->numPrefixFields || prefixExprs[ixtag->pos] != nullptr) { ++curChild; continue; } @@ -505,7 +505,7 @@ void QueryPlannerAccess::finishTextNode(QuerySolutionNode* node, const IndexEntr // Go through the prefix equalities in order and create an index prefix out of them. for (size_t i = 0; i < prefixExprs.size(); ++i) { MatchExpression* prefixMe = prefixExprs[i]; - invariant(NULL != prefixMe); + invariant(nullptr != prefixMe); invariant(MatchExpression::EQ == prefixMe->matchType()); EqualityMatchExpression* eqExpr = static_cast<EqualityMatchExpression*>(prefixMe); prefixBob.append(eqExpr->getData()); @@ -651,12 +651,12 @@ void QueryPlannerAccess::findElemMatchChildren(const MatchExpression* node, vector<MatchExpression*>* subnodesOut) { for (size_t i = 0; i < node->numChildren(); ++i) { MatchExpression* child = node->getChild(i); - if (Indexability::isBoundsGenerating(child) && NULL != child->getTag()) { + if (Indexability::isBoundsGenerating(child) && nullptr != child->getTag()) { out->push_back(child); } else if (MatchExpression::AND == child->matchType() || Indexability::arrayUsesIndexOnChildren(child)) { findElemMatchChildren(child, out, subnodesOut); - } else if (NULL != child->getTag()) { + } else if (nullptr != child->getTag()) { subnodesOut->push_back(child); } } @@ -728,7 +728,7 @@ bool QueryPlannerAccess::processIndexScans(const CanonicalQuery& query, // If there is no tag, it's not using an index. We've sorted our children such that the // children with tags are first, so we stop now. - if (NULL == child->getTag()) { + if (nullptr == child->getTag()) { break; } @@ -789,7 +789,7 @@ bool QueryPlannerAccess::processIndexScans(const CanonicalQuery& query, mergeWithLeafNode(child, &scanState); handleFilter(&scanState); } else { - if (NULL != scanState.currentScan.get()) { + if (nullptr != scanState.currentScan.get()) { // Output the current scan before starting to construct a new out. finishAndOutputLeaf(&scanState, out); } else { @@ -810,7 +810,7 @@ bool QueryPlannerAccess::processIndexScans(const CanonicalQuery& query, } // Output the scan we're done with, if it exists. - if (NULL != scanState.currentScan.get()) { + if (nullptr != scanState.currentScan.get()) { finishAndOutputLeaf(&scanState, out); } @@ -876,13 +876,13 @@ bool QueryPlannerAccess::processIndexScansElemMatch( // the complete $elemMatch expression will be affixed as a filter later on. for (size_t i = 0; i < emChildren.size(); ++i) { MatchExpression* emChild = emChildren[i]; - invariant(NULL != emChild->getTag()); + invariant(nullptr != emChild->getTag()); scanState->ixtag = static_cast<IndexTag*>(emChild->getTag()); // If 'emChild' is a NOT, then the tag we're interested in is on the NOT's // child node. if (MatchExpression::NOT == emChild->matchType()) { - invariant(NULL != emChild->getChild(0)->getTag()); + invariant(nullptr != emChild->getChild(0)->getTag()); scanState->ixtag = static_cast<IndexTag*>(emChild->getChild(0)->getTag()); invariant(IndexTag::kNoIndex != scanState->ixtag->index); } @@ -895,7 +895,7 @@ bool QueryPlannerAccess::processIndexScansElemMatch( scanState->tightness = IndexBoundsBuilder::INEXACT_FETCH; mergeWithLeafNode(emChild, scanState); } else { - if (NULL != scanState->currentScan.get()) { + if (nullptr != scanState->currentScan.get()) { finishAndOutputLeaf(scanState, out); } else { verify(IndexTag::kNoIndex == scanState->currentIndexNumber); @@ -972,7 +972,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::buildIndexedAnd( std::vector<std::unique_ptr<QuerySolutionNode>> ixscanNodes; const bool inArrayOperator = !ownedRoot; if (!processIndexScans(query, root, inArrayOperator, indices, params, &ixscanNodes)) { - return NULL; + return nullptr; } // @@ -1095,7 +1095,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::buildIndexedOr( const bool inArrayOperator = !ownedRoot; std::vector<std::unique_ptr<QuerySolutionNode>> ixscanNodes; if (!processIndexScans(query, root, inArrayOperator, indices, params, &ixscanNodes)) { - return NULL; + return nullptr; } // Unlike an AND, an OR cannot have filters hanging off of it. We stop processing @@ -1106,7 +1106,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::buildIndexedOr( // We won't enumerate an OR without indices for each child, so this isn't an issue, even // if we have an AND with an OR child -- we won't get here unless the OR is fully // indexed. - return NULL; + return nullptr; } // If all index scans are identical, then we collapse them into a single scan. This prevents @@ -1196,7 +1196,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::_buildIndexedDataAccess( IndexBoundsBuilder::BoundsTightness tightness = IndexBoundsBuilder::EXACT; auto soln = makeLeafNode(query, indices[tag->index], tag->pos, root, &tightness); - verify(NULL != soln); + verify(nullptr != soln); finishLeafNode(soln.get(), indices[tag->index]); if (!ownedRoot) { @@ -1216,7 +1216,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::_buildIndexedDataAccess( return soln; } else if (tightness == IndexBoundsBuilder::INEXACT_COVERED && !indices[tag->index].multikey) { - verify(NULL == soln->filter.get()); + verify(nullptr == soln->filter.get()); soln->filter = std::move(ownedRoot); return soln; } else { @@ -1293,7 +1293,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::scanWholeIndex( void QueryPlannerAccess::addFilterToSolutionNode(QuerySolutionNode* node, MatchExpression* match, MatchExpression::MatchType type) { - if (NULL == node->filter) { + if (nullptr == node->filter) { node->filter.reset(match); } else if (type == node->filter->matchType()) { // The 'node' already has either an AND or OR filter that matches 'type'. Add 'match' as diff --git a/src/mongo/db/query/planner_access.h b/src/mongo/db/query/planner_access.h index e0744d55311..3c9b03ff4d0 100644 --- a/src/mongo/db/query/planner_access.h +++ b/src/mongo/db/query/planner_access.h @@ -146,7 +146,7 @@ private: currentScan(nullptr), curChild(0), currentIndexNumber(IndexTag::kNoIndex), - ixtag(NULL), + ixtag(nullptr), tightness(IndexBoundsBuilder::INEXACT_FETCH), curOr(nullptr), loosestBounds(IndexBoundsBuilder::EXACT) {} @@ -157,7 +157,7 @@ private: * This always should be called prior to allocating a new 'currentScan'. */ void resetForNextScan(IndexTag* newTag) { - currentScan.reset(NULL); + currentScan.reset(nullptr); currentIndexNumber = newTag->index; tightness = IndexBoundsBuilder::INEXACT_FETCH; loosestBounds = IndexBoundsBuilder::EXACT; diff --git a/src/mongo/db/query/planner_analysis.cpp b/src/mongo/db/query/planner_analysis.cpp index 1e8e84da6a7..2be65fbf8d2 100644 --- a/src/mongo/db/query/planner_analysis.cpp +++ b/src/mongo/db/query/planner_analysis.cpp @@ -628,7 +628,7 @@ QuerySolutionNode* QueryPlannerAnalysis::analyzeSort(const CanonicalQuery& query // If we're not allowed to put a blocking sort in, bail out. if (params.options & QueryPlannerParams::NO_BLOCKING_SORT) { delete solnRoot; - return NULL; + return nullptr; } if (!solnRoot->fetched()) { diff --git a/src/mongo/db/query/planner_ixselect.cpp b/src/mongo/db/query/planner_ixselect.cpp index 77f662a4701..f15b87b470c 100644 --- a/src/mongo/db/query/planner_ixselect.cpp +++ b/src/mongo/db/query/planner_ixselect.cpp @@ -557,7 +557,7 @@ bool QueryPlannerIXSelect::_compatible(const BSONElement& keyPatternElt, const CapWithCRS* cap = gc.getCapGeometryHack(); // 2d indices can answer centerSphere queries. - if (NULL == cap) { + if (nullptr == cap) { return false; } @@ -666,7 +666,7 @@ void QueryPlannerIXSelect::_rateIndices(MatchExpression* node, fullPath = prefix + node->path().toString(); } - verify(NULL == node->getTag()); + verify(nullptr == node->getTag()); node->setTag(new RelevantTag()); auto rt = static_cast<RelevantTag*>(node->getTag()); rt->path = fullPath; @@ -995,7 +995,7 @@ static void stripInvalidAssignmentsToTextIndex(MatchExpression* node, MatchExpression* child = node->getChild(i); RelevantTag* tag = static_cast<RelevantTag*>(child->getTag()); - if (NULL == tag) { + if (nullptr == tag) { // 'child' could be a logical operator. Maybe there are some assignments hiding // inside. stripInvalidAssignmentsToTextIndex(child, idx, prefixPaths); diff --git a/src/mongo/db/query/query_planner.cpp b/src/mongo/db/query/query_planner.cpp index ad97acfc6c1..9735dbade0e 100644 --- a/src/mongo/db/query/query_planner.cpp +++ b/src/mongo/db/query/query_planner.cpp @@ -373,16 +373,16 @@ StatusWith<std::unique_ptr<PlanCacheIndexTree>> QueryPlanner::cacheDataFromTagge Status QueryPlanner::tagAccordingToCache(MatchExpression* filter, const PlanCacheIndexTree* const indexTree, const map<IndexEntry::Identifier, size_t>& indexMap) { - if (NULL == filter) { + if (nullptr == filter) { return Status(ErrorCodes::BadValue, "Cannot tag tree: filter is NULL."); } - if (NULL == indexTree) { + if (nullptr == indexTree) { return Status(ErrorCodes::BadValue, "Cannot tag tree: indexTree is NULL."); } // We're tagging the tree here, so it shouldn't have // any tags hanging off yet. - verify(NULL == filter->getTag()); + verify(nullptr == filter->getTag()); if (filter->numChildren() != indexTree->children.size()) { str::stream ss; @@ -721,7 +721,7 @@ StatusWith<std::vector<std::unique_ptr<QuerySolution>>> QueryPlanner::plan( LOG(5) << "Rated tree:" << endl << redact(query.root()->debugString()); // If there is a GEO_NEAR it must have an index it can use directly. - const MatchExpression* gnNode = NULL; + const MatchExpression* gnNode = nullptr; if (QueryPlannerCommon::hasNode(query.root(), MatchExpression::GEO_NEAR, &gnNode)) { // No index for GEO_NEAR? No query. RelevantTag* tag = static_cast<RelevantTag*>(gnNode->getTag()); @@ -736,7 +736,7 @@ StatusWith<std::vector<std::unique_ptr<QuerySolution>>> QueryPlanner::plan( } // Likewise, if there is a TEXT it must have an index it can use directly. - const MatchExpression* textNode = NULL; + const MatchExpression* textNode = nullptr; if (QueryPlannerCommon::hasNode(query.root(), MatchExpression::TEXT, &textNode)) { RelevantTag* tag = static_cast<RelevantTag*>(textNode->getTag()); @@ -832,7 +832,8 @@ StatusWith<std::vector<std::unique_ptr<QuerySolution>>> QueryPlanner::plan( // Produce legible error message for failed OR planning with a TEXT child. // TODO: support collection scan for non-TEXT children of OR. - if (out.size() == 0 && textNode != NULL && MatchExpression::OR == query.root()->matchType()) { + if (out.size() == 0 && textNode != nullptr && + MatchExpression::OR == query.root()->matchType()) { MatchExpression* root = query.root(); for (size_t i = 0; i < root->numChildren(); ++i) { if (textNode == root->getChild(i)) { diff --git a/src/mongo/db/query/query_planner_common.h b/src/mongo/db/query/query_planner_common.h index 4cbfc1147dc..c232291e0e3 100644 --- a/src/mongo/db/query/query_planner_common.h +++ b/src/mongo/db/query/query_planner_common.h @@ -47,9 +47,9 @@ public: */ static bool hasNode(const MatchExpression* root, MatchExpression::MatchType type, - const MatchExpression** out = NULL) { + const MatchExpression** out = nullptr) { if (type == root->matchType()) { - if (NULL != out) { + if (nullptr != out) { *out = root; } return true; diff --git a/src/mongo/db/query/query_planner_test.cpp b/src/mongo/db/query/query_planner_test.cpp index 757625df59d..6a91e1ec742 100644 --- a/src/mongo/db/query/query_planner_test.cpp +++ b/src/mongo/db/query/query_planner_test.cpp @@ -4605,7 +4605,7 @@ TEST_F(QueryPlannerTest, KeyPatternOverflowsInt) { TEST_F(QueryPlannerTest, CacheDataFromTaggedTreeFailsOnBadInput) { // Null match expression. std::vector<IndexEntry> relevantIndices; - ASSERT_NOT_OK(QueryPlanner::cacheDataFromTaggedTree(NULL, relevantIndices).getStatus()); + ASSERT_NOT_OK(QueryPlanner::cacheDataFromTaggedTree(nullptr, relevantIndices).getStatus()); // No relevant index matching the index tag. relevantIndices.push_back(buildSimpleIndexEntry(BSON("a" << 1), "a_1")); @@ -4636,11 +4636,11 @@ TEST_F(QueryPlannerTest, TagAccordingToCacheFailsOnBadInput) { std::map<IndexEntry::Identifier, size_t> indexMap; // Null filter. - Status s = QueryPlanner::tagAccordingToCache(NULL, indexTree.get(), indexMap); + Status s = QueryPlanner::tagAccordingToCache(nullptr, indexTree.get(), indexMap); ASSERT_NOT_OK(s); // Null indexTree. - s = QueryPlanner::tagAccordingToCache(scopedCq->root(), NULL, indexMap); + s = QueryPlanner::tagAccordingToCache(scopedCq->root(), nullptr, indexMap); ASSERT_NOT_OK(s); // Index not found. diff --git a/src/mongo/db/query/query_planner_test_lib.cpp b/src/mongo/db/query/query_planner_test_lib.cpp index 2cfcc54985b..f0861044b3a 100644 --- a/src/mongo/db/query/query_planner_test_lib.cpp +++ b/src/mongo/db/query/query_planner_test_lib.cpp @@ -58,7 +58,7 @@ using std::string; bool filterMatches(const BSONObj& testFilter, const BSONObj& testCollation, const QuerySolutionNode* trueFilterNode) { - if (NULL == trueFilterNode->filter) { + if (nullptr == trueFilterNode->filter) { return false; } @@ -267,7 +267,7 @@ bool QueryPlannerTestLib::solutionMatches(const BSONObj& testSoln, if (filter.eoo()) { return true; } else if (filter.isNull()) { - return NULL == csn->filter; + return nullptr == csn->filter; } else if (!filter.isABSONObj()) { return false; } @@ -336,7 +336,7 @@ bool QueryPlannerTestLib::solutionMatches(const BSONObj& testSoln, if (filter.eoo()) { return true; } else if (filter.isNull()) { - return NULL == ixn->filter; + return nullptr == ixn->filter; } else if (!filter.isABSONObj()) { return false; } @@ -453,7 +453,7 @@ bool QueryPlannerTestLib::solutionMatches(const BSONObj& testSoln, BSONElement filter = textObj["filter"]; if (!filter.eoo()) { if (filter.isNull()) { - if (NULL != node->filter) { + if (nullptr != node->filter) { return false; } } else if (!filter.isABSONObj()) { @@ -490,7 +490,7 @@ bool QueryPlannerTestLib::solutionMatches(const BSONObj& testSoln, BSONElement filter = fetchObj["filter"]; if (!filter.eoo()) { if (filter.isNull()) { - if (NULL != fn->filter) { + if (nullptr != fn->filter) { return false; } } else if (!filter.isABSONObj()) { @@ -533,7 +533,7 @@ bool QueryPlannerTestLib::solutionMatches(const BSONObj& testSoln, BSONElement filter = andHashObj["filter"]; if (!filter.eoo()) { if (filter.isNull()) { - if (NULL != ahn->filter) { + if (nullptr != ahn->filter) { return false; } } else if (!filter.isABSONObj()) { @@ -564,7 +564,7 @@ bool QueryPlannerTestLib::solutionMatches(const BSONObj& testSoln, BSONElement filter = andSortedObj["filter"]; if (!filter.eoo()) { if (filter.isNull()) { - if (NULL != asn->filter) { + if (nullptr != asn->filter) { return false; } } else if (!filter.isABSONObj()) { diff --git a/src/mongo/db/query/query_solution.cpp b/src/mongo/db/query/query_solution.cpp index 23c83c6fb8a..9f1951c14a9 100644 --- a/src/mongo/db/query/query_solution.cpp +++ b/src/mongo/db/query/query_solution.cpp @@ -203,7 +203,7 @@ void TextNode::appendToString(str::stream* ss, int indent) const { *ss << "diacriticSensitive= " << ftsQuery->getDiacriticSensitive() << '\n'; addIndent(ss, indent + 1); *ss << "indexPrefix = " << indexPrefix.toString() << '\n'; - if (NULL != filter) { + if (nullptr != filter) { addIndent(ss, indent + 1); *ss << " filter = " << filter->debugString(); } @@ -233,7 +233,7 @@ void CollectionScanNode::appendToString(str::stream* ss, int indent) const { *ss << "COLLSCAN\n"; addIndent(ss, indent + 1); *ss << "ns = " << name << '\n'; - if (NULL != filter) { + if (nullptr != filter) { addIndent(ss, indent + 1); *ss << "filter = " << filter->debugString(); } @@ -265,7 +265,7 @@ AndHashNode::~AndHashNode() {} void AndHashNode::appendToString(str::stream* ss, int indent) const { addIndent(ss, indent); *ss << "AND_HASH\n"; - if (NULL != filter) { + if (nullptr != filter) { addIndent(ss, indent + 1); *ss << " filter = " << filter->debugString() << '\n'; } @@ -369,7 +369,7 @@ OrNode::~OrNode() {} void OrNode::appendToString(str::stream* ss, int indent) const { addIndent(ss, indent); *ss << "OR\n"; - if (NULL != filter) { + if (nullptr != filter) { addIndent(ss, indent + 1); *ss << " filter = " << filter->debugString() << '\n'; } @@ -430,7 +430,7 @@ MergeSortNode::~MergeSortNode() {} void MergeSortNode::appendToString(str::stream* ss, int indent) const { addIndent(ss, indent); *ss << "MERGE_SORT\n"; - if (NULL != filter) { + if (nullptr != filter) { addIndent(ss, indent + 1); *ss << " filter = " << filter->debugString() << '\n'; } @@ -489,7 +489,7 @@ FetchNode::FetchNode() : _sorts(SimpleBSONObjComparator::kInstance.makeBSONObjSe void FetchNode::appendToString(str::stream* ss, int indent) const { addIndent(ss, indent); *ss << "FETCH\n"; - if (NULL != filter) { + if (nullptr != filter) { addIndent(ss, indent + 1); StringBuilder sb; *ss << "filter:\n"; @@ -529,7 +529,7 @@ void IndexScanNode::appendToString(str::stream* ss, int indent) const { addIndent(ss, indent + 1); *ss << "indexName = " << index.identifier.catalogName << '\n'; *ss << "keyPattern = " << index.keyPattern << '\n'; - if (NULL != filter) { + if (nullptr != filter) { addIndent(ss, indent + 1); *ss << "filter = " << filter->debugString(); } @@ -1041,7 +1041,7 @@ void GeoNear2DNode::appendToString(str::stream* ss, int indent) const { *ss << "keyPattern = " << index.keyPattern.toString() << '\n'; addCommon(ss, indent); *ss << "nearQuery = " << nq->toString() << '\n'; - if (NULL != filter) { + if (nullptr != filter) { addIndent(ss, indent + 1); *ss << " filter = " << filter->debugString(); } @@ -1075,7 +1075,7 @@ void GeoNear2DSphereNode::appendToString(str::stream* ss, int indent) const { *ss << "baseBounds = " << baseBounds.toString() << '\n'; addIndent(ss, indent + 1); *ss << "nearQuery = " << nq->toString() << '\n'; - if (NULL != filter) { + if (nullptr != filter) { addIndent(ss, indent + 1); *ss << " filter = " << filter->debugString(); } @@ -1101,7 +1101,7 @@ QuerySolutionNode* GeoNear2DSphereNode::clone() const { void ShardingFilterNode::appendToString(str::stream* ss, int indent) const { addIndent(ss, indent); *ss << "SHARDING_FILTER\n"; - if (NULL != filter) { + if (nullptr != filter) { addIndent(ss, indent + 1); StringBuilder sb; *ss << "filter:\n"; diff --git a/src/mongo/db/query/query_solution.h b/src/mongo/db/query/query_solution.h index 44c63d4bfb6..a665b823529 100644 --- a/src/mongo/db/query/query_solution.h +++ b/src/mongo/db/query/query_solution.h @@ -147,7 +147,7 @@ struct QuerySolutionNode { for (size_t i = 0; i < this->children.size(); i++) { other->children.push_back(this->children[i]->clone()); } - if (NULL != this->filter) { + if (nullptr != this->filter) { other->filter = this->filter->shallowClone(); } } @@ -229,7 +229,7 @@ struct QuerySolution { * Output a human-readable std::string representing the plan. */ std::string toString() { - if (NULL == root) { + if (nullptr == root) { return "empty query solution"; } |