MCPcopy Create free account
hub / github.com/bytedance/bolt / addFunction

Method addFunction

bolt/vector/FunctionVector.h:154–168  ·  view source on GitHub ↗

Implements evaluation of the lambda function literal special form. This assigns a function to a specified set of rows. This supports a situation of returning different lambdas from different cases of a conditional. FunctionVectors enforce single assignment. A lambda cannot be for example a loop variable.

Source from the content-addressed store, hash-verified

152 // different cases of a conditional. FunctionVectors enforce single
153 // assignment. A lambda cannot be for example a loop variable.
154 void addFunction(
155 std::shared_ptr<Callable> callable,
156 const SelectivityVector& rows) {
157 for (auto& otherRows : rowSets_) {
158 auto begin = std::max(rows.begin(), otherRows.begin());
159 auto end = std::min(rows.end(), otherRows.end());
160 BOLT_CHECK(
161 !bits::hasIntersection(
162 otherRows.asRange().bits(), rows.asRange().bits(), begin, end),
163 "Functions in a FunctionVector may not have intersecting SelectivityVectors");
164 }
165
166 rowSets_.push_back(rows);
167 functions_.push_back(callable);
168 }
169
170 bool containsNullAt(vector_size_t idx) const override {
171 return false;

Callers 2

touchMethod · 0.80
evalSpecialFormMethod · 0.80

Calls 8

hasIntersectionFunction · 0.85
maxFunction · 0.50
minFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
bitsMethod · 0.45
asRangeMethod · 0.45
push_backMethod · 0.45

Tested by 1

touchMethod · 0.64