| 635 | } |
| 636 | |
| 637 | int32_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 | |
| 671 | void RowContainer::store(const RowVectorPtr& input) { |
| 672 | BOLT_CHECK_EQ(input->childrenSize(), types_.size()); |
nothing calls this directly
no test coverage detected