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

Method applyDictionaryWrapper

bolt/vector/DecodedVector.cpp:205–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205void DecodedVector::applyDictionaryWrapper(
206 const BaseVector& dictionaryVector,
207 const SelectivityVector* rows) {
208 if (size_ == 0 || (rows && !rows->hasSelections())) {
209 // No further processing is needed.
210 return;
211 }
212
213 auto newIndices = dictionaryVector.wrapInfo()->as<vector_size_t>();
214 auto newNulls = dictionaryVector.rawNulls();
215 if (newNulls) {
216 hasExtraNulls_ = true;
217 mayHaveNulls_ = true;
218 // if we have both nulls for parent and the wrapped vectors, and nulls
219 // buffer is not copied, make a copy because we may need to
220 // change it when iterating through wrapped vector
221 if (!nulls_ || nullsNotCopied()) {
222 copyNulls(end(rows));
223 }
224 }
225 auto copiedNulls = copiedNulls_.data();
226 auto currentIndices = indices_;
227 if (indicesNotCopied()) {
228 copiedIndices_.resize(size_);
229 indices_ = copiedIndices_.data();
230 }
231
232 applyToRows(rows, [&](vector_size_t row) {
233 if (!nulls_ || !bits::isBitNull(nulls_, row)) {
234 auto wrappedIndex = currentIndices[row];
235 if (newNulls && bits::isBitNull(newNulls, wrappedIndex)) {
236 bits::setNull(copiedNulls, row);
237 } else {
238 copiedIndices_[row] = newIndices[wrappedIndex];
239 }
240 }
241 });
242}
243
244void DecodedVector::fillInIndices() {
245 if (isConstantMapping_) {

Callers

nothing calls this directly

Calls 8

copyNullsFunction · 0.85
isBitNullFunction · 0.85
hasSelectionsMethod · 0.80
rawNullsMethod · 0.80
setNullFunction · 0.70
wrapInfoMethod · 0.45
dataMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected