MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / copyFromValue

Method copyFromValue

src/common/vector/value_vector.cpp:163–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163void ValueVector::copyFromValue(uint64_t pos, const Value& value) {
164 if (value.isNull()) {
165 setNull(pos, true);
166 return;
167 }
168 setNull(pos, false);
169 auto dstValue = valueBuffer.get() + pos * numBytesPerValue;
170 switch (dataType.getPhysicalType()) {
171 case PhysicalTypeID::INT64: {
172 memcpy(dstValue, &value.val.int64Val, numBytesPerValue);
173 } break;
174 case PhysicalTypeID::INT32: {
175 memcpy(dstValue, &value.val.int32Val, numBytesPerValue);
176 } break;
177 case PhysicalTypeID::INT16: {
178 memcpy(dstValue, &value.val.int16Val, numBytesPerValue);
179 } break;
180 case PhysicalTypeID::INT8: {
181 memcpy(dstValue, &value.val.int8Val, numBytesPerValue);
182 } break;
183 case PhysicalTypeID::UINT64: {
184 memcpy(dstValue, &value.val.uint64Val, numBytesPerValue);
185 } break;
186 case PhysicalTypeID::UINT32: {
187 memcpy(dstValue, &value.val.uint32Val, numBytesPerValue);
188 } break;
189 case PhysicalTypeID::UINT16: {
190 memcpy(dstValue, &value.val.uint16Val, numBytesPerValue);
191 } break;
192 case PhysicalTypeID::UINT8: {
193 memcpy(dstValue, &value.val.uint8Val, numBytesPerValue);
194 } break;
195 case PhysicalTypeID::INT128: {
196 memcpy(dstValue, &value.val.int128Val, numBytesPerValue);
197 } break;
198 case PhysicalTypeID::DOUBLE: {
199 memcpy(dstValue, &value.val.doubleVal, numBytesPerValue);
200 } break;
201 case PhysicalTypeID::FLOAT: {
202 memcpy(dstValue, &value.val.floatVal, numBytesPerValue);
203 } break;
204 case PhysicalTypeID::BOOL: {
205 memcpy(dstValue, &value.val.booleanVal, numBytesPerValue);
206 } break;
207 case PhysicalTypeID::INTERVAL: {
208 memcpy(dstValue, &value.val.intervalVal, numBytesPerValue);
209 } break;
210 case PhysicalTypeID::STRING:
211 case PhysicalTypeID::JSON: {
212 StringVector::addString(this, *(string_t*)dstValue, value.strVal.data(),
213 value.strVal.length());
214 } break;
215 case PhysicalTypeID::ARRAY:
216 case PhysicalTypeID::LIST: {
217 auto listEntry = reinterpret_cast<list_entry_t*>(dstValue);
218 auto numValues = NestedVal::getChildrenSize(&value);
219 *listEntry = ListVector::addList(this, numValues);
220 auto dstDataVector = ListVector::getDataVector(this);

Callers 5

resolveResultVectorMethod · 0.80
deSerializeMethod · 0.80
bindInsertNodeMethod · 0.80
bindInsertRelMethod · 0.80

Calls 11

setNullFunction · 0.85
addListFunction · 0.85
getFieldVectorsFunction · 0.85
lengthMethod · 0.80
getDataVectorFunction · 0.50
isNullMethod · 0.45
getMethod · 0.45
getPhysicalTypeMethod · 0.45
dataMethod · 0.45
setNullMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected