| 162 | } |
| 163 | |
| 164 | std::unique_ptr<PhysicalOperator> PlanMapper::mapExtend(const LogicalOperator* logicalOperator) { |
| 165 | auto extend = logicalOperator->constPtrCast<LogicalExtend>(); |
| 166 | auto outFSchema = extend->getSchema(); |
| 167 | auto inFSchema = extend->getChild(0)->getSchema(); |
| 168 | auto boundNode = extend->getBoundNode(); |
| 169 | auto nbrNode = extend->getNbrNode(); |
| 170 | auto rel = extend->getRel(); |
| 171 | auto extendDirection = extend->getDirection(); |
| 172 | const auto physicalOperatorType = |
| 173 | logicalOperator->getOperatorType() == LogicalOperatorType::PACKED_EXTEND ? |
| 174 | PhysicalOperatorType::PACKED_EXTEND : |
| 175 | PhysicalOperatorType::SCAN_REL_TABLE; |
| 176 | auto prevOperator = mapOperator(logicalOperator->getChild(0).get()); |
| 177 | auto inNodeIDPos = getDataPos(*boundNode->getInternalID(), *inFSchema); |
| 178 | std::vector<DataPos> outVectorsPos; |
| 179 | auto outNodeIDPos = getDataPos(*nbrNode->getInternalID(), *outFSchema); |
| 180 | outVectorsPos.push_back(outNodeIDPos); |
| 181 | for (auto& expression : extend->getProperties()) { |
| 182 | outVectorsPos.push_back(getDataPos(*expression, *outFSchema)); |
| 183 | } |
| 184 | auto scanInfo = ScanOpInfo(inNodeIDPos, outVectorsPos); |
| 185 | std::vector<std::string> tableNames; |
| 186 | auto storageManager = StorageManager::Get(*clientContext); |
| 187 | for (auto entry : rel->getEntries()) { |
| 188 | tableNames.push_back(entry->getName()); |
| 189 | } |
| 190 | auto printInfo = std::make_unique<ScanRelTablePrintInfo>(tableNames, extend->getProperties(), |
| 191 | boundNode, rel, nbrNode, extendDirection, rel->getVariableName()); |
| 192 | if (scanSingleRelTable(*rel, *boundNode, extendDirection)) { |
| 193 | DASSERT(rel->getNumEntries() == 1); |
| 194 | auto entry = rel->getEntry(0)->ptrCast<RelGroupCatalogEntry>(); |
| 195 | auto relDataDirection = ExtendDirectionUtil::getRelDataDirection(extendDirection); |
| 196 | auto entryInfo = entry->getSingleRelEntryInfo(); |
| 197 | auto relTable = storageManager->getTable(entryInfo.oid)->ptrCast<RelTable>(); |
| 198 | auto scanRelInfo = |
| 199 | getRelTableScanInfo(*entry, relDataDirection, relTable, extend->shouldScanNbrID(), |
| 200 | extend->getProperties(), extend->getPropertyPredicates(), clientContext); |
| 201 | if (logicalOperator->getChild(0)->getOperatorType() == |
| 202 | LogicalOperatorType::SCAN_NODE_TABLE) { |
| 203 | auto* scanNode = logicalOperator->getChild(0)->ptrCast<LogicalScanNodeTable>(); |
| 204 | if (scanNode->getScanType() == LogicalScanNodeTableType::SCAN) { |
| 205 | std::vector<NodeTable*> sourceNodeTables; |
| 206 | std::vector<ScanNodeTableInfo> sourceNodeTableInfos; |
| 207 | std::vector<std::shared_ptr<ScanNodeTableSharedState>> sourceNodeSharedStates; |
| 208 | auto expectedBoundTableID = relDataDirection == RelDataDirection::FWD ? |
| 209 | relTable->getFromNodeTableID() : |
| 210 | relTable->getToNodeTableID(); |
| 211 | auto catalog = catalog::Catalog::Get(*clientContext); |
| 212 | auto transaction = transaction::Transaction::Get(*clientContext); |
| 213 | for (auto tableID : scanNode->getTableIDs()) { |
| 214 | if (tableID == expectedBoundTableID) { |
| 215 | auto table = storageManager->getTable(tableID)->ptrCast<NodeTable>(); |
| 216 | sourceNodeTables.push_back(table); |
| 217 | auto tableEntry = catalog->getTableCatalogEntry(transaction, tableID); |
| 218 | sourceNodeTableInfos.push_back( |
| 219 | getNodeTableScanInfo(*scanNode, table, tableEntry, clientContext)); |
| 220 | auto semiMask = |
| 221 | SemiMaskUtil::createMask(table->getNumTotalRows(transaction)); |
nothing calls this directly
no test coverage detected