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

Function readStringView

bolt/exec/ContainerRowSerde.cpp:898–909  ·  view source on GitHub ↗

Returns a view over a serialized string with the string as a contiguous array of bytes. This may use 'storage' for a temporary copy.

Source from the content-addressed store, hash-verified

896// contiguous array of bytes. This may use 'storage' for a temporary
897// copy.
898StringView readStringView(ByteInputStream& stream, std::string& storage) {
899 int32_t size = stream.read<int32_t>();
900 auto view = stream.nextView(size);
901 if (view.size() == size) {
902 // The string is all in one piece, no copy.
903 return StringView(view.data(), view.size());
904 }
905 storage.resize(size);
906 memcpy(storage.data(), view.data(), view.size());
907 stream.readBytes(storage.data() + view.size(), size - view.size());
908 return StringView(storage);
909}
910
911// Comparison of two serializations.
912std::optional<int32_t> compareSwitch(

Callers 2

VARCHAR>Method · 0.70
VARBINARY>Method · 0.70

Calls 7

memcpyFunction · 0.85
StringViewClass · 0.50
nextViewMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
resizeMethod · 0.45
readBytesMethod · 0.45

Tested by

no test coverage detected