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

Method setGetNumberImpl

src/Functions/array/arraySetGet.cpp:184–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182
183 template <bool Nullable, typename Method, typename DataType>
184 inline void setGetNumberImpl(Method & method, const ColumnArray & array, ColumnArray & result) const
185 {
186 ConstNullMapPtr null_map{};
187 ColumnRawPtrs key_cols;
188 key_cols.push_back(&array.getData());
189 if(Nullable) extractNestedColumnsAndNullMap(key_cols, null_map);
190
191 if (auto * result_column = typeid_cast<ColumnVector<DataType> *>(&result.getData()))
192 {
193 typename Method::State state(key_cols, {}, nullptr);
194 typename ColumnVector<DataType>::Container & result_container = result_column->getData();
195 size_t rsize = array.size();
196 const auto & offsets = array.getOffsets();
197 auto & res_offsets = result.getOffsets();
198 size_t pre_offset = 0, cur_offset = 0;
199
200 Arena arena(0);
201 for (size_t i = 0; i<rsize; ++i)
202 {
203 // get current elems in this array input
204 cur_offset = offsets[i];
205 size_t element_size = 0;
206 for (size_t j = pre_offset; j < cur_offset; ++j)
207 {
208 if (Nullable && (*null_map)[j]) continue;
209 auto key_holder = state.getKeyHolder(j, arena);
210 if (method.data.has(key_holder))
211 {
212 result_container.push_back(key_holder);
213 element_size++;
214 }
215 }
216 res_offsets.push_back(res_offsets.back() + element_size);
217 pre_offset = offsets[i];
218 }
219 }
220 }
221
222};
223

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected