diff options
author | Anton Korshunov <anton.korshunov@mongodb.com> | 2019-11-15 10:19:14 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-11-15 10:19:14 +0000 |
commit | 73b456d5c059b17d1c7f0f8badb7c72391ee2173 (patch) | |
tree | 89451cae5a7cfbedb3a2faccd307bc870f7b0a40 /src/mongo/db/query | |
parent | cc3f2c8ba06e9e8c248a0d91a9efd5351311ca37 (diff) | |
download | mongo-73b456d5c059b17d1c7f0f8badb7c72391ee2173.tar.gz |
SERVER-43291 Consolidate projection execution interfaces
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r-- | src/mongo/db/query/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/query/collection_query_info.cpp | 14 | ||||
-rw-r--r-- | src/mongo/db/query/get_executor.cpp | 15 | ||||
-rw-r--r-- | src/mongo/db/query/get_executor_test.cpp | 38 | ||||
-rw-r--r-- | src/mongo/db/query/index_entry.h | 11 | ||||
-rw-r--r-- | src/mongo/db/query/plan_cache_indexability.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/query/plan_cache_indexability.h | 9 | ||||
-rw-r--r-- | src/mongo/db/query/plan_cache_indexability_test.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/query/plan_cache_test.cpp | 15 | ||||
-rw-r--r-- | src/mongo/db/query/planner_ixselect_test.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/query/planner_wildcard_helpers.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/query/projection_policies.h | 24 | ||||
-rw-r--r-- | src/mongo/db/query/query_planner_wildcard_index_test.cpp | 4 |
13 files changed, 95 insertions, 64 deletions
diff --git a/src/mongo/db/query/SConscript b/src/mongo/db/query/SConscript index b39bf5d553d..876ab2b8c77 100644 --- a/src/mongo/db/query/SConscript +++ b/src/mongo/db/query/SConscript @@ -42,6 +42,7 @@ env.Library( "$BUILD_DIR/mongo/base", "$BUILD_DIR/mongo/db/bson/dotted_path_support", '$BUILD_DIR/mongo/db/commands/server_status_core', + "$BUILD_DIR/mongo/db/exec/projection_executor", "$BUILD_DIR/mongo/db/index/expression_params", "$BUILD_DIR/mongo/db/index/key_generator", "$BUILD_DIR/mongo/db/index_names", diff --git a/src/mongo/db/query/collection_query_info.cpp b/src/mongo/db/query/collection_query_info.cpp index b0e5685d7ad..ccf86e6a759 100644 --- a/src/mongo/db/query/collection_query_info.cpp +++ b/src/mongo/db/query/collection_query_info.cpp @@ -39,6 +39,8 @@ #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/concurrency/d_concurrency.h" #include "mongo/db/curop_metrics.h" +#include "mongo/db/exec/projection_executor.h" +#include "mongo/db/exec/projection_executor_utils.h" #include "mongo/db/fts/fts_spec.h" #include "mongo/db/index/index_descriptor.h" #include "mongo/db/index/wildcard_access_method.h" @@ -60,9 +62,9 @@ CoreIndexInfo indexInfoFromIndexCatalogEntry(const IndexCatalogEntry& ice) { auto accessMethod = ice.accessMethod(); invariant(accessMethod); - const ProjectionExecAgg* projExec = nullptr; + projection_executor::ProjectionExecutor* projExec = nullptr; if (desc->getIndexType() == IndexType::INDEX_WILDCARD) - projExec = static_cast<const WildcardAccessMethod*>(accessMethod)->getProjectionExec(); + projExec = static_cast<const WildcardAccessMethod*>(accessMethod)->getProjectionExecutor(); return {desc->keyPattern(), desc->getIndexType(), @@ -102,15 +104,17 @@ void CollectionQueryInfo::computeIndexKeys(OperationContext* opCtx) { if (descriptor->getAccessMethodName() == IndexNames::WILDCARD) { // Obtain the projection used by the $** index's key generator. const auto* pathProj = - static_cast<const WildcardAccessMethod*>(iam)->getProjectionExec(); + static_cast<const WildcardAccessMethod*>(iam)->getProjectionExecutor(); // If the projection is an exclusion, then we must check the new document's keys on all // updates, since we do not exhaustively know the set of paths to be indexed. - if (pathProj->getType() == ProjectionExecAgg::ProjectionType::kExclusionProjection) { + if (pathProj->getType() == + TransformerInterface::TransformerType::kExclusionProjection) { _indexedPaths.allPathsIndexed(); } else { // If a subtree was specified in the keyPattern, or if an inclusion projection is // present, then we need only index the path(s) preserved by the projection. - for (const auto& path : pathProj->getExhaustivePaths()) { + for (const auto& path : + projection_executor_utils::extractExhaustivePaths(pathProj)) { _indexedPaths.addPath(path); } } diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index e7f0513fbbc..df61af88f4e 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -48,6 +48,7 @@ #include "mongo/db/exec/idhack.h" #include "mongo/db/exec/multi_plan.h" #include "mongo/db/exec/projection.h" +#include "mongo/db/exec/projection_executor_utils.h" #include "mongo/db/exec/record_store_fast_count.h" #include "mongo/db/exec/return_key.h" #include "mongo/db/exec/shard_filter.h" @@ -165,17 +166,18 @@ IndexEntry indexEntryFromIndexCatalogEntry(OperationContext* opCtx, const bool isMultikey = desc->isMultikey(); - const ProjectionExecAgg* projExec = nullptr; + projection_executor::ProjectionExecutor* projExec = nullptr; std::set<FieldRef> multikeyPathSet; if (desc->getIndexType() == IndexType::INDEX_WILDCARD) { - projExec = static_cast<const WildcardAccessMethod*>(accessMethod)->getProjectionExec(); + projExec = static_cast<const WildcardAccessMethod*>(accessMethod)->getProjectionExecutor(); if (isMultikey) { MultikeyMetadataAccessStats mkAccessStats; if (canonicalQuery) { stdx::unordered_set<std::string> fields; QueryPlannerIXSelect::getFields(canonicalQuery->root(), &fields); - const auto projectedFields = projExec->applyProjectionToFields(fields); + const auto projectedFields = + projection_executor_utils::applyProjectionToFields(projExec, fields); multikeyPathSet = accessMethod->getMultikeyPathSet(opCtx, projectedFields, &mkAccessStats); @@ -1389,9 +1391,10 @@ QueryPlannerParams fillOutPlannerParamsForDistinct(OperationContext* opCtx, indexEntryFromIndexCatalogEntry(opCtx, *ice, parsedDistinct.getQuery())); } else if (desc->getIndexType() == IndexType::INDEX_WILDCARD && !query.isEmpty()) { // Check whether the $** projection captures the field over which we are distinct-ing. - const auto* proj = - static_cast<const WildcardAccessMethod*>(ice->accessMethod())->getProjectionExec(); - if (proj->applyProjectionToOneField(parsedDistinct.getKey())) { + auto* proj = static_cast<const WildcardAccessMethod*>(ice->accessMethod()) + ->getProjectionExecutor(); + if (projection_executor_utils::applyProjectionToOneField(proj, + parsedDistinct.getKey())) { plannerParams.indices.push_back( indexEntryFromIndexCatalogEntry(opCtx, *ice, parsedDistinct.getQuery())); } diff --git a/src/mongo/db/query/get_executor_test.cpp b/src/mongo/db/query/get_executor_test.cpp index d54080debef..9b36fcab408 100644 --- a/src/mongo/db/query/get_executor_test.cpp +++ b/src/mongo/db/query/get_executor_test.cpp @@ -37,7 +37,12 @@ #include <string> #include "mongo/bson/simple_bsonobj_comparator.h" +#include "mongo/db/exec/projection_executor.h" +#include "mongo/db/exec/projection_executor_builder.h" #include "mongo/db/json.h" +#include "mongo/db/pipeline/expression_context_for_test.h" +#include "mongo/db/query/projection_parser.h" +#include "mongo/db/query/projection_policies.h" #include "mongo/db/query/query_settings.h" #include "mongo/db/query/query_test_service_context.h" #include "mongo/stdx/unordered_set.h" @@ -47,6 +52,13 @@ using namespace mongo; namespace { +auto createProjectionExecutor(const BSONObj& spec, const ProjectionPolicies& policies) { + const boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); + auto projection = projection_ast::parse(expCtx, spec, policies); + auto executor = projection_executor::buildProjectionExecutor( + expCtx, &projection, policies, true /* optimizeExecutor */); + return executor; +} using std::unique_ptr; @@ -138,7 +150,7 @@ IndexEntry buildSimpleIndexEntry(const BSONObj& kp, const std::string& indexName * is neccesary for wildcard indicies. */ IndexEntry buildWildcardIndexEntry(const BSONObj& kp, - const ProjectionExecAgg* projExec, + projection_executor::ProjectionExecutor* projExec, const std::string& indexName) { return {kp, IndexNames::nameToType(IndexNames::findPluginName(kp)), @@ -207,10 +219,10 @@ TEST(GetExecutorTest, GetAllowedIndicesMatchesMultipleIndexesByKey) { } TEST(GetExecutorTest, GetAllowedWildcardIndicesByKey) { - auto projExec = ProjectionExecAgg::create( + auto projExec = createProjectionExecutor( fromjson("{_id: 0}"), - ProjectionExecAgg::DefaultIdPolicy::kExcludeId, - ProjectionExecAgg::ArrayRecursionPolicy::kDoNotRecurseNestedArrays); + {ProjectionPolicies::DefaultIdPolicy::kExcludeId, + ProjectionPolicies::ArrayRecursionPolicy::kDoNotRecurseNestedArrays}); testAllowedIndices({buildWildcardIndexEntry(BSON("$**" << 1), projExec.get(), "$**_1"), buildSimpleIndexEntry(fromjson("{a: 1}"), "a_1"), buildSimpleIndexEntry(fromjson("{a: 1, b: 1}"), "a_1_b_1"), @@ -221,10 +233,10 @@ TEST(GetExecutorTest, GetAllowedWildcardIndicesByKey) { } TEST(GetExecutorTest, GetAllowedWildcardIndicesByName) { - auto projExec = ProjectionExecAgg::create( + auto projExec = createProjectionExecutor( fromjson("{_id: 0}"), - ProjectionExecAgg::DefaultIdPolicy::kExcludeId, - ProjectionExecAgg::ArrayRecursionPolicy::kDoNotRecurseNestedArrays); + {ProjectionPolicies::DefaultIdPolicy::kExcludeId, + ProjectionPolicies::ArrayRecursionPolicy::kDoNotRecurseNestedArrays}); testAllowedIndices({buildWildcardIndexEntry(BSON("$**" << 1), projExec.get(), "$**_1"), buildSimpleIndexEntry(fromjson("{a: 1}"), "a_1"), buildSimpleIndexEntry(fromjson("{a: 1, b: 1}"), "a_1_b_1"), @@ -235,10 +247,10 @@ TEST(GetExecutorTest, GetAllowedWildcardIndicesByName) { } TEST(GetExecutorTest, GetAllowedPathSpecifiedWildcardIndicesByKey) { - auto projExec = ProjectionExecAgg::create( + auto projExec = createProjectionExecutor( fromjson("{_id: 0}"), - ProjectionExecAgg::DefaultIdPolicy::kExcludeId, - ProjectionExecAgg::ArrayRecursionPolicy::kDoNotRecurseNestedArrays); + {ProjectionPolicies::DefaultIdPolicy::kExcludeId, + ProjectionPolicies::ArrayRecursionPolicy::kDoNotRecurseNestedArrays}); testAllowedIndices({buildWildcardIndexEntry(BSON("a.$**" << 1), projExec.get(), "a.$**_1"), buildSimpleIndexEntry(fromjson("{a: 1}"), "a_1"), buildSimpleIndexEntry(fromjson("{a: 1, b: 1}"), "a_1_b_1"), @@ -249,10 +261,10 @@ TEST(GetExecutorTest, GetAllowedPathSpecifiedWildcardIndicesByKey) { } TEST(GetExecutorTest, GetAllowedPathSpecifiedWildcardIndicesByName) { - auto projExec = ProjectionExecAgg::create( + auto projExec = createProjectionExecutor( fromjson("{_id: 0}"), - ProjectionExecAgg::DefaultIdPolicy::kExcludeId, - ProjectionExecAgg::ArrayRecursionPolicy::kDoNotRecurseNestedArrays); + {ProjectionPolicies::DefaultIdPolicy::kExcludeId, + ProjectionPolicies::ArrayRecursionPolicy::kDoNotRecurseNestedArrays}); testAllowedIndices({buildWildcardIndexEntry(BSON("a.$**" << 1), projExec.get(), "a.$**_1"), buildSimpleIndexEntry(fromjson("{a: 1}"), "a_1"), buildSimpleIndexEntry(fromjson("{a: 1, b: 1}"), "a_1_b_1"), diff --git a/src/mongo/db/query/index_entry.h b/src/mongo/db/query/index_entry.h index efe9179bc1d..d9eaf0ecdd7 100644 --- a/src/mongo/db/query/index_entry.h +++ b/src/mongo/db/query/index_entry.h @@ -32,7 +32,6 @@ #include <set> #include <string> -#include "mongo/db/exec/projection_exec_agg.h" #include "mongo/db/field_ref.h" #include "mongo/db/index/multikey_paths.h" #include "mongo/db/index_names.h" @@ -41,9 +40,11 @@ #include "mongo/util/str.h" namespace mongo { - class CollatorInterface; class MatchExpression; +namespace projection_executor { +class ProjectionExecutor; +} /** * A CoreIndexInfo is a representation of an index in the catalog with parsed information which is @@ -60,7 +61,7 @@ struct CoreIndexInfo { Identifier ident, const MatchExpression* fe = nullptr, const CollatorInterface* ci = nullptr, - const ProjectionExecAgg* projExec = nullptr) + projection_executor::ProjectionExecutor* projExec = nullptr) : identifier(std::move(ident)), keyPattern(kp), filterExpr(fe), @@ -137,7 +138,7 @@ struct CoreIndexInfo { // For $** indexes, a pointer to the projection executor owned by the index access method. Null // unless this IndexEntry represents a wildcard index, in which case this is always non-null. - const ProjectionExecAgg* wildcardProjection = nullptr; + projection_executor::ProjectionExecutor* wildcardProjection = nullptr; }; /** @@ -159,7 +160,7 @@ struct IndexEntry : CoreIndexInfo { const MatchExpression* fe, const BSONObj& io, const CollatorInterface* ci, - const ProjectionExecAgg* projExec) + projection_executor::ProjectionExecutor* projExec) : CoreIndexInfo(kp, type, sp, std::move(ident), fe, ci, projExec), multikey(mk), multikeyPaths(mkp), diff --git a/src/mongo/db/query/plan_cache_indexability.cpp b/src/mongo/db/query/plan_cache_indexability.cpp index 71d1fa456ce..96f7697e06c 100644 --- a/src/mongo/db/query/plan_cache_indexability.cpp +++ b/src/mongo/db/query/plan_cache_indexability.cpp @@ -35,6 +35,7 @@ #include "mongo/base/init.h" #include "mongo/base/owned_pointer_vector.h" +#include "mongo/db/exec/projection_executor_utils.h" #include "mongo/db/index/wildcard_key_generator.h" #include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression_algo.h" @@ -148,7 +149,8 @@ IndexToDiscriminatorMap PlanCacheIndexabilityState::buildWildcardDiscriminators( IndexToDiscriminatorMap ret; for (auto&& wildcardDiscriminator : _wildcardIndexDiscriminators) { - if (wildcardDiscriminator.projectionExec->applyProjectionToOneField(path)) { + if (projection_executor_utils::applyProjectionToOneField( + wildcardDiscriminator.projectionExec, path)) { CompositeIndexabilityDiscriminator& cid = ret[wildcardDiscriminator.catalogName]; // We can use these 'shallow' functions because the code building the plan cache key diff --git a/src/mongo/db/query/plan_cache_indexability.h b/src/mongo/db/query/plan_cache_indexability.h index 426cec2fb25..e98e7101fc8 100644 --- a/src/mongo/db/query/plan_cache_indexability.h +++ b/src/mongo/db/query/plan_cache_indexability.h @@ -32,16 +32,17 @@ #include <functional> #include <vector> -#include "mongo/db/exec/projection_exec_agg.h" #include "mongo/util/string_map.h" namespace mongo { - class BSONObj; class CollatorInterface; class CompositeIndexabilityDiscriminator; class MatchExpression; struct CoreIndexInfo; +namespace projection_executor { +class ProjectionExecutor; +} using IndexabilityDiscriminator = std::function<bool(const MatchExpression* me)>; using IndexabilityDiscriminators = std::vector<IndexabilityDiscriminator>; @@ -116,7 +117,7 @@ private: * index. */ struct WildcardIndexDiscriminatorContext { - WildcardIndexDiscriminatorContext(const ProjectionExecAgg* proj, + WildcardIndexDiscriminatorContext(projection_executor::ProjectionExecutor* proj, std::string name, const MatchExpression* filter, const CollatorInterface* coll) @@ -126,7 +127,7 @@ private: catalogName(std::move(name)) {} // These are owned by the catalog. - const ProjectionExecAgg* projectionExec; + projection_executor::ProjectionExecutor* projectionExec; const MatchExpression* filterExpr; // For partial indexes. const CollatorInterface* collator; diff --git a/src/mongo/db/query/plan_cache_indexability_test.cpp b/src/mongo/db/query/plan_cache_indexability_test.cpp index 48116f58416..eb2978ef6db 100644 --- a/src/mongo/db/query/plan_cache_indexability_test.cpp +++ b/src/mongo/db/query/plan_cache_indexability_test.cpp @@ -53,12 +53,12 @@ std::unique_ptr<MatchExpression> parseMatchExpression(const BSONObj& obj, return std::move(status.getValue()); } -// Helper which constructs a $** IndexEntry and returns it along with an owned ProjectionExecAgg. -// The latter simulates the ProjectionExecAgg which, during normal operation, is owned and +// Helper which constructs a $** IndexEntry and returns it along with an owned ProjectionExecutor. +// The latter simulates the ProjectionExecutor which, during normal operation, is owned and // maintained by the $** index's IndexAccessMethod, and is required because the plan cache will // obtain unowned pointers to it. auto makeWildcardEntry(BSONObj keyPattern, const MatchExpression* filterExpr = nullptr) { - auto projExec = WildcardKeyGenerator::createProjectionExec(keyPattern, {}); + auto projExec = WildcardKeyGenerator::createProjectionExecutor(keyPattern, {}); return std::make_pair(IndexEntry(keyPattern, IndexNames::nameToType(IndexNames::findPluginName(keyPattern)), false, // multikey diff --git a/src/mongo/db/query/plan_cache_test.cpp b/src/mongo/db/query/plan_cache_test.cpp index a4ee72710d8..ce580870ca9 100644 --- a/src/mongo/db/query/plan_cache_test.cpp +++ b/src/mongo/db/query/plan_cache_test.cpp @@ -239,12 +239,13 @@ void assertEquivalent(const char* queryStr, FAIL(ss); } -// Helper which constructs a $** IndexEntry and returns it along with an owned ProjectionExecAgg. -// The latter simulates the ProjectionExecAgg which, during normal operation, is owned and +// Helper which constructs a $** IndexEntry and returns it along with an owned ProjectionExecutor. +// The latter simulates the ProjectionExecutor which, during normal operation, is owned and // maintained by the $** index's IndexAccessMethod, and is required because the plan cache will // obtain unowned pointers to it. -std::pair<IndexEntry, std::unique_ptr<ProjectionExecAgg>> makeWildcardEntry(BSONObj keyPattern) { - auto projExec = WildcardKeyGenerator::createProjectionExec(keyPattern, {}); +std::pair<IndexEntry, std::unique_ptr<projection_executor::ProjectionExecutor>> makeWildcardEntry( + BSONObj keyPattern) { + auto projExec = WildcardKeyGenerator::createProjectionExecutor(keyPattern, {}); return {IndexEntry(keyPattern, IndexNames::nameToType(IndexNames::findPluginName(keyPattern)), false, // multikey @@ -261,9 +262,9 @@ std::pair<IndexEntry, std::unique_ptr<ProjectionExecAgg>> makeWildcardEntry(BSON } // A version of the above for CoreIndexInfo, used for plan cache update tests. -std::pair<CoreIndexInfo, std::unique_ptr<ProjectionExecAgg>> makeWildcardUpdate( - BSONObj keyPattern) { - auto projExec = WildcardKeyGenerator::createProjectionExec(keyPattern, {}); +std::pair<CoreIndexInfo, std::unique_ptr<projection_executor::ProjectionExecutor>> +makeWildcardUpdate(BSONObj keyPattern) { + auto projExec = WildcardKeyGenerator::createProjectionExecutor(keyPattern, {}); return {CoreIndexInfo(keyPattern, IndexNames::nameToType(IndexNames::findPluginName(keyPattern)), false, // sparse diff --git a/src/mongo/db/query/planner_ixselect_test.cpp b/src/mongo/db/query/planner_ixselect_test.cpp index e1018a87944..406104b96b0 100644 --- a/src/mongo/db/query/planner_ixselect_test.cpp +++ b/src/mongo/db/query/planner_ixselect_test.cpp @@ -1050,15 +1050,15 @@ TEST(QueryPlannerIXSelectTest, NoStringComparisonType) { } } -// Helper which constructs an IndexEntry and returns it along with an owned ProjectionExecAgg, which -// is non-null if the requested entry represents a wildcard index and null otherwise. When non-null, -// it simulates the ProjectionExecAgg that is owned by the $** IndexAccessMethod. +// Helper which constructs an IndexEntry and returns it along with an owned ProjectionExecutor, +// which is non-null if the requested entry represents a wildcard index and null otherwise. When +// non-null, it simulates the ProjectionExecutor that is owned by the $** IndexAccessMethod. auto makeIndexEntry(BSONObj keyPattern, MultikeyPaths multiKeyPaths, std::set<FieldRef> multiKeyPathSet = {}, BSONObj infoObj = BSONObj()) { auto projExec = (keyPattern.firstElement().fieldNameStringData().endsWith("$**"_sd) - ? WildcardKeyGenerator::createProjectionExec( + ? WildcardKeyGenerator::createProjectionExecutor( keyPattern, infoObj.getObjectField("wildcardProjection")) : nullptr); diff --git a/src/mongo/db/query/planner_wildcard_helpers.cpp b/src/mongo/db/query/planner_wildcard_helpers.cpp index 43f4ab69bb3..edf768c75a3 100644 --- a/src/mongo/db/query/planner_wildcard_helpers.cpp +++ b/src/mongo/db/query/planner_wildcard_helpers.cpp @@ -36,6 +36,7 @@ #include <vector> #include "mongo/bson/util/builder.h" +#include "mongo/db/exec/projection_executor_utils.h" #include "mongo/db/index/wildcard_key_generator.h" #include "mongo/db/query/index_bounds.h" #include "mongo/util/log.h" @@ -355,13 +356,12 @@ void expandWildcardIndexEntry(const IndexEntry& wildcardIndex, invariant(wildcardIndex.multikeyPaths.empty()); // Obtain the projection executor from the parent wildcard IndexEntry. - const auto* projExec = wildcardIndex.wildcardProjection; + auto projExec = wildcardIndex.wildcardProjection; invariant(projExec); - const auto projectedFields = projExec->applyProjectionToFields(fields); - - const auto& includedPaths = projExec->getExhaustivePaths(); - + const auto projectedFields = + projection_executor_utils::applyProjectionToFields(projExec, fields); + const auto& includedPaths = projection_executor_utils::extractExhaustivePaths(projExec); out->reserve(out->size() + projectedFields.size()); for (auto&& fieldName : projectedFields) { // Convert string 'fieldName' into a FieldRef, to better facilitate the subsequent checks. diff --git a/src/mongo/db/query/projection_policies.h b/src/mongo/db/query/projection_policies.h index 4d2d6a54fba..09094227c86 100644 --- a/src/mongo/db/query/projection_policies.h +++ b/src/mongo/db/query/projection_policies.h @@ -64,18 +64,24 @@ struct ProjectionPolicies { FindOnlyFeaturesPolicy::kBanFindOnlyFeatures; static ProjectionPolicies findProjectionPolicies() { - return ProjectionPolicies{ - ProjectionPolicies::kDefaultIdPolicyDefault, - ProjectionPolicies::kArrayRecursionPolicyDefault, - ProjectionPolicies::kComputedFieldsPolicyDefault, - ProjectionPolicies::FindOnlyFeaturesPolicy::kAllowFindOnlyFeatures}; + return ProjectionPolicies{kDefaultIdPolicyDefault, + kArrayRecursionPolicyDefault, + kComputedFieldsPolicyDefault, + FindOnlyFeaturesPolicy::kAllowFindOnlyFeatures}; } static ProjectionPolicies aggregateProjectionPolicies() { - return ProjectionPolicies{ProjectionPolicies::kDefaultIdPolicyDefault, - ProjectionPolicies::kArrayRecursionPolicyDefault, - ProjectionPolicies::kComputedFieldsPolicyDefault, - ProjectionPolicies::FindOnlyFeaturesPolicy::kBanFindOnlyFeatures}; + return ProjectionPolicies{kDefaultIdPolicyDefault, + kArrayRecursionPolicyDefault, + kComputedFieldsPolicyDefault, + FindOnlyFeaturesPolicy::kBanFindOnlyFeatures}; + } + + static ProjectionPolicies wildcardIndexSpecProjectionPolicies() { + return ProjectionPolicies{DefaultIdPolicy::kExcludeId, + ArrayRecursionPolicy::kDoNotRecurseNestedArrays, + ComputedFieldsPolicy::kBanComputedFields, + FindOnlyFeaturesPolicy::kBanFindOnlyFeatures}; } ProjectionPolicies( diff --git a/src/mongo/db/query/query_planner_wildcard_index_test.cpp b/src/mongo/db/query/query_planner_wildcard_index_test.cpp index 318d43728e9..4044262b10a 100644 --- a/src/mongo/db/query/query_planner_wildcard_index_test.cpp +++ b/src/mongo/db/query/query_planner_wildcard_index_test.cpp @@ -71,7 +71,7 @@ protected: const bool isMultikey = !multikeyPathSet.empty(); BSONObj infoObj = BSON("wildcardProjection" << wildcardProjection); - _projExec = WildcardKeyGenerator::createProjectionExec(keyPattern, wildcardProjection); + _projExec = WildcardKeyGenerator::createProjectionExecutor(keyPattern, wildcardProjection); params.indices.push_back({std::move(keyPattern), IndexType::INDEX_WILDCARD, @@ -87,7 +87,7 @@ protected: _projExec.get()}); } - std::unique_ptr<ProjectionExecAgg> _projExec; + std::unique_ptr<projection_executor::ProjectionExecutor> _projExec; }; // |