MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / appendNonRecursiveExtend

Method appendNonRecursiveExtend

src/planner/plan/append_extend.cpp:71–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void Planner::appendNonRecursiveExtend(const std::shared_ptr<NodeExpression>& boundNode,
72 const std::shared_ptr<NodeExpression>& nbrNode, const std::shared_ptr<RelExpression>& rel,
73 ExtendDirection direction, bool extendFromSource, const expression_vector& properties,
74 LogicalPlan& plan) {
75 // Filter bound node label if we know some incoming nodes won't have any outgoing rel. This
76 // cannot be done at binding time because the pruning is affected by extend direction.
77 auto boundNodeTableIDSet = getBoundNodeTableIDSet(*rel, direction);
78 if (boundNode->getNumEntries() > boundNodeTableIDSet.size()) {
79 appendNodeLabelFilter(boundNode->getInternalID(), boundNodeTableIDSet, plan);
80 }
81 auto properties_ = properties;
82 // Append extend
83 auto extend = make_shared<LogicalExtend>(boundNode, nbrNode, rel, direction, extendFromSource,
84 properties_, plan.getLastOperator());
85 extend->computeFactorizedSchema();
86 // Update cost & cardinality. Note that extend does not change factorized cardinality.
87 auto transaction = Transaction::Get(*clientContext);
88 const auto extensionRate =
89 cardinalityEstimator.getExtensionRate(*rel, *boundNode, direction, transaction);
90 extend->setCardinality(plan.getLastOperator()->getCardinality());
91 plan.setCost(CostModel::computeExtendCost(plan));
92 auto group = extend->getSchema()->getGroup(nbrNode->getInternalID());
93 group->setMultiplier(extensionRate);
94 plan.setLastOperator(std::move(extend));
95 auto nbrNodeTableIDSet = getNbrNodeTableIDSet(*rel, direction);
96 if (nbrNodeTableIDSet.size() > nbrNode->getNumEntries()) {
97 appendNodeLabelFilter(nbrNode->getInternalID(), nbrNode->getTableIDsSet(), plan);
98 }
99}
100
101void Planner::appendPackedExtend(const std::shared_ptr<NodeExpression>& boundNode,
102 const std::shared_ptr<NodeExpression>& nbrNode, const std::shared_ptr<RelExpression>& rel,

Callers

nothing calls this directly

Calls 10

getExtensionRateMethod · 0.80
setMultiplierMethod · 0.80
getTableIDsSetMethod · 0.80
getBoundNodeTableIDSetFunction · 0.70
getNbrNodeTableIDSetFunction · 0.70
getNumEntriesMethod · 0.45
sizeMethod · 0.45
setCostMethod · 0.45
getGroupMethod · 0.45

Tested by

no test coverage detected