MCPcopy Create free account
hub / github.com/FoundationDB/fdb-document-layer / planQuery

Function planQuery

src/ExtMsg.actor.cpp:161–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161Reference<Plan> planQuery(Reference<UnboundCollectionContext> cx, bson::BSONObj const& query) {
162 auto predicate = queryToPredicate(query, true);
163 auto simplifiedPredicate = predicate->simplify();
164
165 Reference<Plan> plan = Reference<Plan>(
166 FilterPlan::construct_filter_plan(cx, Reference<Plan>(new TableScanPlan(cx)), simplifiedPredicate));
167 if (verboseConsoleOutput) {
168 fprintf(stderr, "parsed predicate: %s\n", predicate->toString().c_str());
169 fprintf(stderr, " simplified to: %s\n\n", simplifiedPredicate->toString().c_str());
170 }
171 if (verboseLogging) {
172 TraceEvent("BD_GetMatchingDocs")
173 .detail("QueryPredicate", predicate->toString())
174 .detail("SimplifiedPredicate", predicate->toString())
175 .detail("Plan", plan->describe().toString());
176 }
177
178 if (slowQueryLogging && plan->hasScanOfType(PlanType::TableScan)) {
179 std::string collectionName = cx->collectionName();
180 if (!startsWith(collectionName.c_str(), "system."))
181 TraceEvent("SlowQuery")
182 .detail("Database", cx->databaseName())
183 .detail("Collection", collectionName)
184 .detail("Query", query.toString())
185 .detail("Plan", plan->describe().toString());
186 }
187
188 return plan;
189}
190
191Reference<Plan> planProjection(Reference<Plan> plan,
192 bson::BSONObj const& selector,

Calls 8

queryToPredicateFunction · 0.85
startsWithFunction · 0.85
collectionNameMethod · 0.80
databaseNameMethod · 0.80
simplifyMethod · 0.45
toStringMethod · 0.45
describeMethod · 0.45
hasScanOfTypeMethod · 0.45

Tested by

no test coverage detected