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

Method write

src/storage/table/column_chunk_data.cpp:396–423  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394}
395
396void ColumnChunkData::write(ColumnChunkData* chunk, ColumnChunkData* dstOffsets,
397 RelMultiplicity multiplicity) {
398 DASSERT(chunk->dataType.getPhysicalType() == dataType.getPhysicalType() &&
399 dstOffsets->getDataType().getPhysicalType() == PhysicalTypeID::INTERNAL_ID &&
400 chunk->getNumValues() == dstOffsets->getNumValues());
401 for (auto i = 0u; i < dstOffsets->getNumValues(); i++) {
402 const auto dstOffset = dstOffsets->getValue<offset_t>(i);
403 DASSERT(dstOffset < capacity);
404 memcpy(getData() + dstOffset * numBytesPerValue, chunk->getData() + i * numBytesPerValue,
405 numBytesPerValue);
406 numValues = dstOffset >= numValues ? dstOffset + 1 : numValues;
407 }
408 if (nullData || multiplicity == RelMultiplicity::ONE) {
409 for (auto i = 0u; i < dstOffsets->getNumValues(); i++) {
410 const auto dstOffset = dstOffsets->getValue<offset_t>(i);
411 if (multiplicity == RelMultiplicity::ONE && isNull(dstOffset)) {
412 throw CopyException(
413 std::format("Node with offset: {} can only have one neighbour due "
414 "to the MANY-ONE/ONE-ONE relationship constraint.",
415 dstOffset));
416 }
417 if (nullData) {
418 nullData->setNull(dstOffset, chunk->isNull(i));
419 }
420 }
421 }
422 updateInMemoryStats(inMemoryStats, chunk);
423}
424
425// NOTE: This function is only called in LocalTable right now when
426// performing out-of-place committing. LIST has a different logic for

Callers

nothing calls this directly

Calls 13

updateInMemoryStatsFunction · 0.85
setNullFunction · 0.85
setValueFunction · 0.85
getDataTypeMethod · 0.80
getBufferSizeMethod · 0.80
getDataFunction · 0.50
isNullFunction · 0.50
getPhysicalTypeMethod · 0.45
getNumValuesMethod · 0.45
getDataMethod · 0.45
setNullMethod · 0.45
isNullMethod · 0.45

Tested by

no test coverage detected