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

Method copyNodes

src/expression_evaluator/path_evaluator.cpp:102–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void PathExpressionEvaluator::copyNodes(sel_t resultPos, bool isEmptyRels) {
103 auto listSize = 0u;
104 // Calculate list size.
105 for (auto i = 0u; i < expression->getNumChildren(); ++i) {
106 auto child = expression->getChild(i).get();
107 switch (child->dataType.getLogicalTypeID()) {
108 case LogicalTypeID::NODE: {
109 listSize++;
110 } break;
111 case LogicalTypeID::RECURSIVE_REL: {
112 auto vectors = inputVectorsPerChild[i].get();
113 auto inputPos = getCurrentPos(vectors->input, resultPos);
114 listSize += vectors->nodesInput->getValue<list_entry_t>(inputPos).size;
115 } break;
116 default:
117 break;
118 }
119 }
120 if (isEmptyRels) {
121 listSize = 1;
122 }
123 // Add list entry.
124 auto entry = ListVector::addList(resultNodesVector, listSize);
125 resultNodesVector->setValue(resultPos, entry);
126 // Copy field vectors
127 offset_t resultDataPos = entry.offset;
128 auto numChildrenToCopy = isEmptyRels ? 1 : expression->getNumChildren();
129 for (auto i = 0u; i < numChildrenToCopy; ++i) {
130 auto child = expression->getChild(i).get();
131 auto vectors = inputVectorsPerChild[i].get();
132 auto inputPos = getCurrentPos(vectors->input, resultPos);
133 switch (child->dataType.getLogicalTypeID()) {
134 case LogicalTypeID::NODE: {
135 copyFieldVectors(inputPos, vectors->nodeFieldVectors, resultDataPos,
136 resultNodesFieldVectors);
137 } break;
138 case LogicalTypeID::RECURSIVE_REL: {
139 auto& listEntry = vectors->nodesInput->getValue<list_entry_t>(inputPos);
140 for (auto j = 0u; j < listEntry.size; ++j) {
141 copyFieldVectors(listEntry.offset + j, vectors->nodeFieldVectors, resultDataPos,
142 resultNodesFieldVectors);
143 }
144 } break;
145 default:
146 break;
147 }
148 }
149}
150
151uint64_t PathExpressionEvaluator::copyRels(sel_t resultPos) {
152 auto listSize = 0u;

Callers

nothing calls this directly

Calls 7

getCurrentPosFunction · 0.85
addListFunction · 0.85
getNumChildrenMethod · 0.80
getLogicalTypeIDMethod · 0.80
getMethod · 0.45
getChildMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected