MCPcopy Create free account
hub / github.com/ByConity/ByConity / setCheckImpl

Method setCheckImpl

src/Functions/array/arraySetCheck.cpp:185–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183
184 template <typename Method, bool Nullable, bool StringType = false>
185 inline void setCheckImpl(Method& method,
186 const ColumnArray& keys,
187 ColumnUInt8::Container& result,
188 bool first) const
189 {
190 size_t rsize = result.size();
191 ConstNullMapPtr null_map{};
192
193 ColumnRawPtrs key_cols;
194 key_cols.push_back(&keys.getData());
195
196 if(Nullable) extractNestedColumnsAndNullMap(key_cols, null_map);
197
198 Sizes key_sizes;
199 ClearableSetVariants::chooseMethod(key_cols, key_sizes);
200 typename Method::State state(key_cols, key_sizes, nullptr);
201 size_t pre_offset = 0, cur_offset = 0;
202 auto& offsets = keys.getOffsets();
203 Arena arena(0);
204 for (size_t i = 0; i<rsize; ++i)
205 {
206 // get current elems in this array input
207 cur_offset = offsets[i];
208
209 if (first || result[i])
210 {
211 bool has_key = false;
212 for (size_t j = pre_offset; (!has_key) && j < cur_offset; ++j)
213 {
214 if (Nullable && (*null_map)[j]) continue; // skip null input
215 auto key_holder = state.getKeyHolder(j, arena);
216 if constexpr (StringType)
217 has_key = method.data.has(key_holder.key);
218 else
219 has_key = method.data.has(key_holder);
220 }
221 result[i] = has_key;
222 }
223
224 pre_offset = offsets[i];
225 }
226 }
227
228};
229

Callers

nothing calls this directly

Calls 7

sizeMethod · 0.45
push_backMethod · 0.45
getDataMethod · 0.45
getOffsetsMethod · 0.45
getKeyHolderMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected