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

Method storeComplexType

bolt/exec/RowContainer.cpp:842–880  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840}
841
842void RowContainer::storeComplexType(
843 const DecodedVector& decoded,
844 vector_size_t index,
845 bool isKey,
846 char* row,
847 int32_t offset,
848 int32_t nullByte,
849 uint8_t nullMask) {
850 if (decoded.isNullAt(index)) {
851 BOLT_DCHECK(nullMask);
852 row[nullByte] |= nullMask;
853 valueAt<std::string_view>(row, offset) = std::string_view();
854 return;
855 }
856 // RowSizeTracker tracker(row[rowSizeOffset_], *stringAllocator_);
857 ByteOutputStream stream(stringAllocator_.get(), false, false);
858 auto position = stringAllocator_->newWrite(stream);
859 ContainerRowSerdeOptions options{.isKey = isKey};
860 ContainerRowSerde::serialize(
861 *decoded.base(), decoded.index(index), stream, options);
862 stringAllocator_->finishWrite(stream, 0);
863
864 valueAt<std::string_view>(row, offset) = std::string_view(
865 reinterpret_cast<char*>(position.position), stream.size());
866
867 // TODO Fix ByteOutputStream::size() API. @oerling is looking into that.
868 // Fix the 'size' of the std::string_view.
869 // stream.size() is the capacity
870 // stream.size() - stream.remainingSize() is the size of the data + size of
871 // 'next' links (8 bytes per link).
872 auto readStream = prepareRead(row, offset);
873 const auto size = readStream->size();
874 valueAt<std::string_view>(row, offset) =
875 std::string_view(reinterpret_cast<char*>(position.position), size);
876
877 auto value = *reinterpret_cast<uint32_t*>(row + rowSizeOffset_) + size;
878 *reinterpret_cast<uint32_t*>(row + rowSizeOffset_) =
879 std::min<uint64_t>(value, std::numeric_limits<uint32_t>::max());
880}
881
882// static
883int32_t RowContainer::compareStringAsc(

Callers

nothing calls this directly

Calls 10

prepareReadFunction · 0.85
newWriteMethod · 0.80
finishWriteMethod · 0.80
serializeFunction · 0.50
maxFunction · 0.50
isNullAtMethod · 0.45
getMethod · 0.45
baseMethod · 0.45
indexMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected