summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/ce/sampling_estimator.cpp
diff options
context:
space:
mode:
authorSvilen Mihaylov <svilen.mihaylov@mongodb.com>2023-02-03 12:42:32 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-03 14:58:25 +0000
commitad7784a363882830e0e6b5f811d761ba32963053 (patch)
tree75648837d8a01dd8386ad0c1862b0cb4e6f899d6 /src/mongo/db/query/ce/sampling_estimator.cpp
parent3e685a599b7901b6d007764b3e6481b6a225516a (diff)
downloadmongo-ad7784a363882830e0e6b5f811d761ba32963053.tar.gz
SERVER-73429 [CQF] Builder for physical plans
Diffstat (limited to 'src/mongo/db/query/ce/sampling_estimator.cpp')
-rw-r--r--src/mongo/db/query/ce/sampling_estimator.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/mongo/db/query/ce/sampling_estimator.cpp b/src/mongo/db/query/ce/sampling_estimator.cpp
index 63cfa58b527..5573f67e3ca 100644
--- a/src/mongo/db/query/ce/sampling_estimator.cpp
+++ b/src/mongo/db/query/ce/sampling_estimator.cpp
@@ -73,7 +73,11 @@ public:
}
void transport(ABT& n, const SargableNode& node, ABT& childResult, ABT& refs, ABT& binds) {
- ABT result = childResult;
+ // We don't need to estimate cardinality of the sampling query itself, so the NodeCEMap part
+ // is ignored here. We use a builder only because lowerPartialSchemaRequirement requires
+ // one.
+ PhysPlanBuilder result{childResult};
+
// Retain only output bindings without applying filters.
for (const auto& [key, req] : node.getReqMap().conjuncts()) {
if (const auto& boundProjName = req.getBoundProjectionName()) {
@@ -81,11 +85,12 @@ public:
key,
PartialSchemaRequirement{
boundProjName, IntervalReqExpr::makeSingularDNF(), req.getIsPerfOnly()},
- result,
- _phaseManager.getPathToInterval());
+ _phaseManager.getPathToInterval(),
+ boost::none /*residualCE*/,
+ result);
}
}
- std::swap(n, result);
+ std::swap(n, result._node);
}
void transport(ABT& n, const CollationNode& /*node*/, ABT& childResult, ABT& refs) {
@@ -168,18 +173,19 @@ public:
}
if (!isIntervalReqFullyOpenDNF(req.getIntervals())) {
- ABT lowered = extracted;
+ PhysPlanBuilder lowered{extracted};
// Lower requirement without an output binding.
lowerPartialSchemaRequirement(
key,
PartialSchemaRequirement{boost::none /*boundProjectionName*/,
req.getIntervals(),
req.getIsPerfOnly()},
- lowered,
- _phaseManager.getPathToInterval());
- uassert(6624243, "Expected a filter node", lowered.is<FilterNode>());
- result =
- estimateFilterCE(metadata, memo, logicalProps, n, std::move(lowered), result);
+ _phaseManager.getPathToInterval(),
+ boost::none /*residualCE*/,
+ lowered);
+ uassert(6624243, "Expected a filter node", lowered._node.is<FilterNode>());
+ result = estimateFilterCE(
+ metadata, memo, logicalProps, n, std::move(lowered._node), result);
}
}