| 24 | } |
| 25 | |
| 26 | std::unique_ptr<PhysicalOperator> PlanMapper::mapRecursiveExtend( |
| 27 | const LogicalOperator* logicalOperator) { |
| 28 | auto& extend = logicalOperator->constCast<LogicalRecursiveExtend>(); |
| 29 | auto& bindData = extend.getBindData(); |
| 30 | auto columns = extend.getResultColumns(); |
| 31 | auto tableSchema = createFlatFTableSchema(columns, *extend.getSchema()); |
| 32 | auto table = std::make_shared<FactorizedTable>(storage::MemoryManager::Get(*clientContext), |
| 33 | tableSchema.copy()); |
| 34 | auto graph = std::make_unique<OnDiskGraph>(clientContext, bindData.graphEntry.copy()); |
| 35 | auto sharedState = |
| 36 | std::make_shared<RecursiveExtendSharedState>(table, std::move(graph), extend.getLimitNum()); |
| 37 | if (extend.hasInputNodeMask()) { |
| 38 | sharedState->setInputNodeMask(createNodeOffsetMaskMap(*bindData.nodeInput, this)); |
| 39 | } |
| 40 | if (extend.hasOutputNodeMask()) { |
| 41 | sharedState->setOutputNodeMask(createNodeOffsetMaskMap(*bindData.nodeOutput, this)); |
| 42 | } |
| 43 | auto printInfo = |
| 44 | std::make_unique<RecursiveExtendPrintInfo>(extend.getFunction().getFunctionName()); |
| 45 | auto recursiveExtend = std::make_unique<RecursiveExtend>(extend.getFunction().copy(), bindData, |
| 46 | sharedState, getOperatorID(), std::move(printInfo)); |
| 47 | // Map node predicate pipeline |
| 48 | if (extend.hasNodePredicate()) { |
| 49 | addOperatorMapping(logicalOperator, recursiveExtend.get()); |
| 50 | sharedState->setPathNodeMask(std::make_unique<NodeOffsetMaskMap>()); |
| 51 | auto maskMap = sharedState->getPathNodeMaskMap(); |
| 52 | DASSERT(extend.getNumChildren() == 1); |
| 53 | auto logicalRoot = extend.getChild(0); |
| 54 | DASSERT(logicalRoot->getNumChildren() == 1 && |
| 55 | logicalRoot->getChild(0)->getOperatorType() == LogicalOperatorType::SEMI_MASKER); |
| 56 | auto logicalSemiMasker = logicalRoot->getChild(0)->ptrCast<LogicalSemiMasker>(); |
| 57 | logicalSemiMasker->addTarget(logicalOperator); |
| 58 | for (auto tableID : logicalSemiMasker->getNodeTableIDs()) { |
| 59 | maskMap->addMask(tableID, createSemiMask(tableID)); |
| 60 | } |
| 61 | auto root = mapOperator(logicalRoot.get()); |
| 62 | recursiveExtend->addChild(std::move(root)); |
| 63 | eraseOperatorMapping(logicalOperator); |
| 64 | } |
| 65 | logicalOpToPhysicalOpMap.insert({logicalOperator, recursiveExtend.get()}); |
| 66 | physical_op_vector_t children; |
| 67 | children.push_back(std::move(recursiveExtend)); |
| 68 | return createFTableScanAligned(columns, extend.getSchema(), table, DEFAULT_VECTOR_CAPACITY, |
| 69 | std::move(children)); |
| 70 | } |
| 71 | |
| 72 | } // namespace processor |
| 73 | } // namespace lbug |
nothing calls this directly
no test coverage detected