summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/optimizer/cascades/implementers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/optimizer/cascades/implementers.cpp')
-rw-r--r--src/mongo/db/query/optimizer/cascades/implementers.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/mongo/db/query/optimizer/cascades/implementers.cpp b/src/mongo/db/query/optimizer/cascades/implementers.cpp
index 6039ac3cb43..835045a2611 100644
--- a/src/mongo/db/query/optimizer/cascades/implementers.cpp
+++ b/src/mongo/db/query/optimizer/cascades/implementers.cpp
@@ -189,8 +189,7 @@ public:
if (node.getArraySize() == 0) {
nodeCEMap.emplace(physNode.cast<Node>(), 0.0);
- physNode =
- make<LimitSkipNode>(properties::LimitSkipRequirement{0, 0}, std::move(physNode));
+ physNode = make<LimitSkipNode>(LimitSkipRequirement{0, 0}, std::move(physNode));
nodeCEMap.emplace(physNode.cast<Node>(), 0.0);
for (const ProjectionName& boundProjName : node.binder().names()) {
@@ -208,8 +207,7 @@ public:
} else {
nodeCEMap.emplace(physNode.cast<Node>(), 1.0);
- physNode =
- make<LimitSkipNode>(properties::LimitSkipRequirement{1, 0}, std::move(physNode));
+ physNode = make<LimitSkipNode>(LimitSkipRequirement{1, 0}, std::move(physNode));
nodeCEMap.emplace(physNode.cast<Node>(), 1.0);
const ProjectionName valueScanProj = _prefixId.getNextId("valueScan");
@@ -710,7 +708,21 @@ public:
return;
}
const bool isIndex = indexReqTarget == IndexReqTarget::Index;
- if (isIndex && (!node.hasLeftIntervals() || !node.hasRightIntervals())) {
+
+ const GroupIdType leftGroupId =
+ node.getLeftChild().cast<MemoLogicalDelegatorNode>()->getGroupId();
+ const GroupIdType rightGroupId =
+ node.getRightChild().cast<MemoLogicalDelegatorNode>()->getGroupId();
+
+ const LogicalProps& leftLogicalProps = _memo.getLogicalProps(leftGroupId);
+ const LogicalProps& rightLogicalProps = _memo.getLogicalProps(rightGroupId);
+
+ const bool hasProperIntervalLeft =
+ getPropertyConst<IndexingAvailability>(leftLogicalProps).hasProperInterval();
+ const bool hasProperIntervalRight =
+ getPropertyConst<IndexingAvailability>(rightLogicalProps).hasProperInterval();
+
+ if (isIndex && (!hasProperIntervalLeft || !hasProperIntervalRight)) {
// We need to have proper intervals on both sides.
return;
}
@@ -729,14 +741,6 @@ public:
}
}
- const GroupIdType leftGroupId =
- node.getLeftChild().cast<MemoLogicalDelegatorNode>()->getGroupId();
- const GroupIdType rightGroupId =
- node.getRightChild().cast<MemoLogicalDelegatorNode>()->getGroupId();
-
- const LogicalProps& leftLogicalProps = _memo.getLogicalProps(leftGroupId);
- const LogicalProps& rightLogicalProps = _memo.getLogicalProps(rightGroupId);
-
const CEType intersectedCE =
getPropertyConst<CardinalityEstimate>(_logicalProps).getEstimate();
const CEType leftCE = getPropertyConst<CardinalityEstimate>(leftLogicalProps).getEstimate();
@@ -1660,9 +1664,9 @@ void addImplementers(const Metadata& metadata,
const QueryHints& hints,
const RIDProjectionsMap& ridProjections,
PrefixId& prefixId,
- const properties::PhysProps& physProps,
+ const PhysProps& physProps,
PhysQueueAndImplPos& queue,
- const properties::LogicalProps& logicalProps,
+ const LogicalProps& logicalProps,
const OrderPreservingABTSet& logicalNodes,
const PathToIntervalFn& pathToInterval) {
ImplementationVisitor visitor(metadata,