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

Method setStringViewValue

bolt/vector/FlatVector.cpp:154–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152
153template <>
154void FlatVector<StringView>::setStringViewValue(
155 vector_size_t idx,
156 StringView value,
157 bool exactSize) {
158 BOLT_DCHECK_LT(idx, BaseVector::length_);
159 ensureValues();
160 BOLT_DCHECK(!values_->isView())
161 if (BaseVector::rawNulls_) {
162 BaseVector::setNull(idx, false);
163 }
164 if (value.isInline()) {
165 rawValues_[idx] = value;
166 } else {
167 Buffer* buffer = getBufferWithSpace(value.size(), exactSize);
168 char* ptr = buffer->asMutable<char>() + buffer->size();
169 buffer->setSize(buffer->size() + value.size());
170 memcpy(ptr, value.data(), value.size());
171 rawValues_[idx] = StringView(ptr, value.size());
172 }
173}
174
175/// For types that requires buffer allocation this should be called only if
176/// value is inlined or if value is already allocated in a buffer within the

Callers 1

extractStringMethod · 0.80

Calls 8

memcpyFunction · 0.85
isInlineMethod · 0.80
setNullFunction · 0.70
StringViewClass · 0.50
isViewMethod · 0.45
sizeMethod · 0.45
setSizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected