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

Method storeVariableSizeAt

bolt/exec/RowContainer.cpp:637–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

635}
636
637int32_t RowContainer::storeVariableSizeAt(
638 const char* data,
639 char* row,
640 column_index_t column) {
641 const auto typeKind = typeKinds_[column];
642 const auto rowColumn = rowColumns_[column];
643
644 // First 4 bytes is the size of the data.
645 const auto size = *reinterpret_cast<const int32_t*>(data);
646
647 if (typeKind == TypeKind::VARCHAR || typeKind == TypeKind::VARBINARY) {
648 valueAt<StringView>(row, rowColumn.offset()) = StringView(data + 4, size);
649 if (size > 0) {
650 stringAllocator_->copyMultipart(
651 StringView(data + 4, size), row, rowColumn.offset());
652 } else {
653 valueAt<StringView>(row, rowColumn.offset()) = StringView();
654 }
655 } else {
656 if (size > 0) {
657 ByteOutputStream stream(stringAllocator_.get(), false, false);
658 const auto position = stringAllocator_->newWrite(stream);
659 stream.appendStringView(std::string_view(data + 4, size));
660 stringAllocator_->finishWrite(stream, 0);
661 valueAt<std::string_view>(row, rowColumn.offset()) =
662 std::string_view(reinterpret_cast<char*>(position.position), size);
663 } else {
664 valueAt<std::string_view>(row, rowColumn.offset()) = std::string_view();
665 }
666 }
667
668 return 4 + size;
669}
670
671void RowContainer::store(const RowVectorPtr& input) {
672 BOLT_CHECK_EQ(input->childrenSize(), types_.size());

Callers

nothing calls this directly

Calls 7

copyMultipartMethod · 0.80
newWriteMethod · 0.80
finishWriteMethod · 0.80
StringViewClass · 0.50
offsetMethod · 0.45
getMethod · 0.45
appendStringViewMethod · 0.45

Tested by

no test coverage detected