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

Class Iterator

bolt/vector/FunctionVector.h:99–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97 // applicable rows. In most situations, there is only one function in
98 // the FunctionVector.
99 class Iterator {
100 public:
101 struct Entry {
102 /// Callable lambda.
103 Callable* callable;
104
105 /// Rows that lambda applies to.
106 SelectivityVector* rows;
107
108 operator bool() const {
109 return callable != nullptr;
110 }
111 };
112
113 Iterator(const FunctionVector* vector, const SelectivityVector* rows)
114 : rows_(*rows),
115 functions_{vector->functions_},
116 rowSets_{vector->rowSets_} {}
117
118 Entry next() {
119 while (index_ < functions_.size()) {
120 effectiveRows_ = rowSets_[index_];
121 effectiveRows_.intersect(rows_);
122 if (!effectiveRows_.hasSelections()) {
123 ++index_;
124 continue;
125 }
126 Entry entry{functions_[index_].get(), &effectiveRows_};
127 ++index_;
128 return entry;
129 }
130 return {nullptr, nullptr};
131 }
132
133 private:
134 const SelectivityVector& rows_;
135 const std::vector<std::shared_ptr<Callable>>& functions_;
136 const std::vector<SelectivityVector>& rowSets_;
137 int32_t index_ = 0;
138 SelectivityVector effectiveRows_;
139 };
140
141 FunctionVector(bolt::memory::MemoryPool* pool, TypePtr type)
142 : BaseVector(

Callers 1

iteratorMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected