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

Method getRelInsertExecutor

src/processor/map/map_insert.cpp:51–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51RelInsertExecutor PlanMapper::getRelInsertExecutor(const LogicalInsertInfo* boundInfo,
52 const Schema& inSchema, const Schema& outSchema) const {
53 auto& rel = boundInfo->pattern->constCast<RelExpression>();
54 auto srcNode = rel.getSrcNode();
55 auto dstNode = rel.getDstNode();
56 auto srcNodeIDPos = getDataPos(*srcNode->getInternalID(), inSchema);
57 auto dstNodeIDPos = getDataPos(*dstNode->getInternalID(), inSchema);
58 auto columnsPos = populateReturnColumnsPos(*boundInfo, outSchema);
59 auto info = RelInsertInfo(srcNodeIDPos, dstNodeIDPos, std::move(columnsPos));
60 auto storageManager = StorageManager::Get(*clientContext);
61 DASSERT(srcNode->getNumEntries() == 1 && dstNode->getNumEntries() == 1);
62 auto srcTableID = srcNode->getEntry(0)->getTableID();
63 auto dstTableID = dstNode->getEntry(0)->getTableID();
64 DASSERT(rel.getNumEntries() == 1);
65 auto& relGroupEntry = rel.getEntry(0)->constCast<RelGroupCatalogEntry>();
66 auto relEntryInfo = relGroupEntry.getRelEntryInfo(srcTableID, dstTableID);
67 auto table = storageManager->getTable(relEntryInfo->oid)->ptrCast<RelTable>();
68 evaluator_vector_t evaluators;
69 auto exprMapper = ExpressionMapper(&outSchema);
70 for (auto& expr : boundInfo->columnDataExprs) {
71 evaluators.push_back(exprMapper.getEvaluator(expr));
72 }
73 auto tableInfo = RelTableInsertInfo(table, std::move(evaluators));
74 return RelInsertExecutor(std::move(info), std::move(tableInfo));
75}
76
77std::unique_ptr<PhysicalOperator> PlanMapper::mapInsert(const LogicalOperator* logicalOperator) {
78 auto& logicalInsert = logicalOperator->constCast<LogicalInsert>();

Callers

nothing calls this directly

Calls 11

populateReturnColumnsPosFunction · 0.85
RelInsertInfoClass · 0.85
ExpressionMapperClass · 0.85
RelTableInsertInfoClass · 0.85
getRelEntryInfoMethod · 0.80
getEvaluatorMethod · 0.80
RelInsertExecutorClass · 0.50
getNumEntriesMethod · 0.45
getEntryMethod · 0.45
getTableMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected