yiguolei commented on code in PR #52735:
URL: https://github.com/apache/doris/pull/52735#discussion_r2194095772
##########
be/src/vec/common/string_buffer.hpp:
##########
@@ -84,11 +126,72 @@ class BufferReadable {
_data += len;
}
+ void read_var_uint(UInt64& x) {
+ x = 0;
+ // get length from first byte firstly
+ uint8_t len = 0;
+ read((char*)&len, 1);
+ auto ref = read(len);
+ // read data and set it to x per byte.
+ char* bytes = const_cast<char*>(ref.data);
+ for (size_t i = 0; i < 9; ++i) {
+ UInt64 byte = bytes[i];
+ x |= (byte & 0x7F) << (7 * i);
+
+ if (!(byte & 0x80)) {
+ return;
+ }
+ }
+ }
+
+ template <typename Type>
+ void read_binary(Type& x) {
+ static_assert(std::is_standard_layout_v<Type>);
+ read(reinterpret_cast<char*>(&x), sizeof(x));
+ }
+
+ template <typename Type>
+ requires(std::is_same_v<Type, String> || std::is_same_v<Type,
PaddedPODArray<UInt8>>)
+ void read_binary(Type& s) {
+ UInt64 size = 0;
+ read_var_uint(size);
+
+ if (size > DEFAULT_MAX_STRING_SIZE) {
+ throw doris::Exception(ErrorCode::INTERNAL_ERROR, "Too large
string size.");
Review Comment:
得把 size 大小输出出来
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]