diff options
author | Jennifer Peshansky <jennifer.peshansky@mongodb.com> | 2022-11-03 16:13:20 +0000 |
---|---|---|
committer | Jennifer Peshansky <jennifer.peshansky@mongodb.com> | 2022-11-03 16:13:20 +0000 |
commit | e74d2910bbe76790ad131d53fee277829cd95982 (patch) | |
tree | cabe148764529c9623652374fbc36323a550cd44 /src/mongo/db/query/optimizer/cascades/implementers.cpp | |
parent | 280145e9940729480bb8a35453d4056afac87641 (diff) | |
parent | ba467f46cc1bc49965e1d72b541eff0cf1d7b22e (diff) | |
download | mongo-jenniferpeshansky/SERVER-70854.tar.gz |
Merge branch 'master' into jenniferpeshansky/SERVER-70854jenniferpeshansky/SERVER-70854
Diffstat (limited to 'src/mongo/db/query/optimizer/cascades/implementers.cpp')
-rw-r--r-- | src/mongo/db/query/optimizer/cascades/implementers.cpp | 34 |
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, |