summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/optimizer/partial_schema_requirements.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/optimizer/partial_schema_requirements.h')
-rw-r--r--src/mongo/db/query/optimizer/partial_schema_requirements.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/mongo/db/query/optimizer/partial_schema_requirements.h b/src/mongo/db/query/optimizer/partial_schema_requirements.h
index 7f0fb77b1cd..de57d4f7012 100644
--- a/src/mongo/db/query/optimizer/partial_schema_requirements.h
+++ b/src/mongo/db/query/optimizer/partial_schema_requirements.h
@@ -36,9 +36,7 @@ namespace mongo::optimizer {
using PartialSchemaEntry = std::pair<PartialSchemaKey, PartialSchemaRequirement>;
using PSRExpr = BoolExpr<PartialSchemaEntry>;
-using PSRExprBuilder = PSRExpr::Builder<false /*simplifyEmptyOrSingular*/,
- false /*removeDups*/,
- NoOpNegator<PartialSchemaEntry>>;
+using PSRExprBuilder = PSRExpr::Builder<false /*simplifyEmptyOrSingular*/, false /*removeDups*/>;
/**
* Represents a set of predicates and projections. Cannot represent all predicates/projections:
@@ -166,7 +164,9 @@ public:
// TODO SERVER-74101: Remove these methods in favor of visitDis/Conjuncts().
Range<true> conjuncts() const {
- assertIsSingletonDisjunction();
+ tassert(7453905,
+ "Expected PartialSchemaRequirement to be a singleton disjunction",
+ PSRExpr::isSingletonDisjunction(_expr));
const auto& atoms = _expr.cast<PSRExpr::Disjunction>()
->nodes()
.begin()
@@ -176,7 +176,9 @@ public:
}
Range<false> conjuncts() {
- assertIsSingletonDisjunction();
+ tassert(7453904,
+ "Expected PartialSchemaRequirement to be a singleton disjunction",
+ PSRExpr::isSingletonDisjunction(_expr));
auto& atoms = _expr.cast<PSRExpr::Disjunction>()
->nodes()
.begin()
@@ -219,11 +221,16 @@ private:
// TODO SERVER-73827: Consider applying this normalization during BoolExpr building.
void normalize();
- // Asserts that _expr is in DNF form where the disjunction has a single conjunction child.
- void assertIsSingletonDisjunction() const;
-
// _expr is currently always in DNF.
PSRExpr::Node _expr;
};
+/**
+ * Returns a vector of ((input binding, path), output binding). The output binding names
+ * are unique and you can think of the vector as a product: every row has all the projections
+ * available.
+ */
+std::vector<std::pair<PartialSchemaKey, ProjectionName>> getBoundProjections(
+ const PartialSchemaRequirements& reqs);
+
} // namespace mongo::optimizer