| 69 | } |
| 70 | |
| 71 | void 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 | |
| 101 | void Planner::appendPackedExtend(const std::shared_ptr<NodeExpression>& boundNode, |
| 102 | const std::shared_ptr<NodeExpression>& nbrNode, const std::shared_ptr<RelExpression>& rel, |
nothing calls this directly
no test coverage detected